-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix warning by checking whether key is set. #909
Fix warning by checking whether key is set. #909
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to recreate your error, and I'm having trouble creating a view that uses a table, but doesn't have options['plugin_id']
. Can you send me some hints, or a screenshot?
And/or, can you test if $field->getPluginId()
works with your view? It would be a nicer way to do this if it solves the problem.
Thanks!
Thanks, @rosiel for looking at this. Yes, $field->getPluginId() works and is cleaner. It eliminates the warning and I tested that drag and drop sorting still works as expected. I have updated the PR. In terms of reproducing the warning, I am attaching a few screenshots of my view where it occurs: |
As mentioned, we are using the drupal/flag module to allow end users to create bookmarks (favourites) for repository items. This view is what the drupal/flag module provides - we have made minimal changes if any. |
I don't think this makes a difference, but I am using PHP 8.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replicated the error, and this fixed it.
* Fix warning by checking whether key is set. * Adjust plugin check in integer-weight views hook.
* Fix warning by checking whether key is set. * Adjust plugin check in integer-weight views hook.
What does this Pull Request do?
We are adding the drupal/flag module to our Islandora instance to allow end users to create bookmarks (favourites) for repository items.
We see the warning "Warning: Undefined array key "plugin_id" in islandora_preprocess_views_view_table() (line 523 of modules/contrib/islandora/islandora.module)" when accessing a view that the drupal/flag module provides.
This PR eliminates this warning by checking for the array key using isset() before trying to use it.
How should this be tested?
The code modified is related to the "integer weight field" functionality. Test that nothing is broken by testing the "Re-order children" page.
Interested parties
@Islandora/committers