Problem/Motivation
Visiting the default (formerly master) display for the media_library view's configuration page results in a dblog/watchdog php notice. Well, two actually:
Notice: Undefined index: defaults in seven_views_pre_render() (line 351 of /var/lib/tugboat/stm/web/core/themes/seven/seven.theme)
andNotice: Undefined index: defaults in media_library_views_pre_render() (line 181 of /var/lib/tugboat/stm/web/core/modules/media_library/media_library.module)
I imagine this is unlikely to be seen by most since it requires having the "Always show the master (default) display" checkbox checked (or set in settings.local.php or whatever), and I honestly don't know even know if it's really a problem that could cause any real-world issues, but since my team's development workflow includes checking the dblog for potential issues in every PR, I wasted some time thinking my edit to that view caused a bug/regression.
Steps to reproduce
- Enable (or have enabled)
media
andmedia_library
. - Go to
/admin/structure/views/settings
and check the "Always show the default display" checkbox. Save the page. - Visit
/admin/structure/views/view/media_library
(and/or maybe just go directly to/admin/structure/views/view/media_library/edit/default
without having to do the previous step?) - Visit
/admin/reports/dblog
and see the two new notices.
Proposed resolution
Of course an isset()
or array_key_exists()
or whatever could be added to those lines in the .module and .theme files, though I don't know if maybe the default display ought to be getting that ['defaults']
key also fed to it instead? (Or maybe those classes should be added regardless of whether ['defaults']
exists or whatever? I don't quite know what all the two hook_views_pre_render()
s are doing in the first place.)