Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294953

"Notice: Undefined index: defaults" when visiting default media_library view

$
0
0

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)
and
Notice: 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

  1. Enable (or have enabled) media and media_library.
  2. Go to /admin/structure/views/settings and check the "Always show the default display" checkbox. Save the page.
  3. 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?)
  4. 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.)

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 294953

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>