Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
When adding a File, Image, or Spotlight widget as an editor, I get a PHP notice if I set the Title.
Error message:
Notice: Undefined property: stdClass::$view_access in PanelsPaneController->access() (line 77 of /www/profiles/panopoly/modules/contrib/fieldable_panels_panes/includes/PanelsPaneController.class.php).
To reproduce:
- Log in as a user with the Editor role
- Go to any panelized page (for example, /content/great-vegetables if you have Demo installed)
- Click Customize this page
- Click an Add new pane button
- Choose Add image
- Start typing in the Title field under General Settings
- Note that when Live Preview finishes, there is a PHP notice
The message goes away after you click Save and exit the widget modal.
The error does not appear on any other widget types - only widgets with a file upload field. And it does not appear for users with the administrator role.
Comment | File | Size | Author |
---|---|---|---|
#1 | panopoly_magic-image-widget-notice-2463389-1.patch | 725 bytes | dsnopek |
Comments
Comment #1
dsnopekI'm not sure why this only happens on widgets with an image field, but I think I know why it only happens on new widgets and when you're not an admin user.
First of all, it only does this access check when you're not an admin user. And the
$entity->view_access
property is set when loading the FPP from the database, but in the case of live preview on a new widget, we're never loading it from the database.So, all we need to do is set
$entity->view_access = NULL
(the default value) if it's not already set, just before callingfieldable_panels_panes_access('view', $entity)
.Here's a patch that works in my testing.
Comment #3
dsnopekCommited!