Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, I'm getting this error when clicking "add" on the No Results Behavior. It happens on every view, including new ones.
Path: /admin/structure/views/ajax/add-item/quotes/book_quotes_pane/empty
StatusText: parsererror
ResponseText: Notice: Undefined index: area in views_ui_add_item_form() (line 4085 of C:\Inetpub\wwwroot\123.com\sites\all\modules\contrib\views\includes\admin.inc). =>
It deals with this line of code:
views_ui_standard_form_buttons($form, $form_state, 'views_ui_add_item_form', t('Add and configure @types', array('@types' => $types[$type]['ltitle'])));
If I wrap that line in a if (isset($types[$type])) {
then the ajax popup works, but has no "save" buttons. Sorry, I don't know how to debug this further, I have no clue.
Comment | File | Size | Author |
---|---|---|---|
#12 | fixed-undefined-index-area-issue-1157716.patch | 660 bytes | neoglez |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedOk, I think the button simply lost its name.
If you check before line 4085 and add this
Then it works, but of course this is not the right approach. I dont know why that button lost its name
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedThis is still a bug in today's latest devx.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #4
neoglez CreditAttribution: neoglez commentedI don't think so, not sure if it ever was a problem.
Are you using a contributed module that insert special JS in every page (for example by implemeting hook_init) or something like that??
Comment #5
magnusk CreditAttribution: magnusk commentedI get the same error message. Still, the footer I define does get added, and it does get displayed in the view.
I'm not using any such module that would insert special JS. There's no JS error in the web console (using Safari).
Comment #6
dawehnerIs it possible that someone can describe how to reproduce the problem.
Just some steps: a-f would really really help to fix the problem.
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedUnable to reproduce, as are others. Clearly there is something different about your system. Not sure what, but can you try this on a fresh install?
Comment #8
David Sparks CreditAttribution: David Sparks commentedI'm getting the same error with the current views-7.x-3.x-dev. The error only appears with JS switched off, or the devel module enabled. Otherwise the undefined index is still encountered ($types['area'] does not exist), but it doesn't prevent the ajax call from completing successfully.
The cause is on line 3855 of includes/admin.inc, when processing the 'header' and 'footer' views object types, both of which have 'type' => 'area' set. Hence !empty($types[$type]['type']) results in $type being reset to 'area', but $types does not contain an 'area' key so $types[$type] on line 3950 gives the undefined index warning.
Should there be an 'area' views object type? That seems to be what is expected - if a views object type has a 'type' then that 'type' should also be a views object type. The 'header' and 'footer' object types both have 'type' set to 'area' in views_object_types().
Comment #9
neoglez CreditAttribution: neoglez commented@ David Sparks you're right.
Please see #8 in #1190510: Missing 'aliases' key definition in views_views_data
and the patch posted in #9 in the same issue.
I have to bring the patch down here ;)
Comment #10
willieseabrook CreditAttribution: willieseabrook commentedI am getting this error on views 7.x-3.0-rc1
Steps to reproduce are to:
1. Enable devel module
2. /admin/config/development/devel --> set error handler to backtrace
3. Create a new view.
4. Click 'add' under header text. Error dialog pops up with a bunch of krumo stuff.
With devel disabled, I can add header text fine - no error. So I guess this is a minor issue, as it doesnt hinder the normal user, and there is a simple workaround.
But its also probably not good having invalid indexes used as that means something is wrong.
Also, I tried the patches in #1190510: Missing 'aliases' key definition in views_views_data suggested by @neoglez, but they didn't fix the issue.
Comment #11
dawehnerIsn't this the same as #1172270: Delay debug backtrace krumo output on json requests ?
Comment #12
neoglez CreditAttribution: neoglez commented@ dereine To be able to reproduce turn of JS in the browser. I'm not using Devel.
(also by fallowing the logic in #8)
Comment #13
R13ose CreditAttribution: R13ose commentedI tried this patch, and this works for me. I was able to edit header and footer of views now.
Comment #14
dawehnerCommited with the fix some lines above as well. Sadly i used the wrong name for the author of the patch, sorry.
Commited to 7.x-3.x
Comment #15
neoglez CreditAttribution: neoglez commentedIt's OK, the most important is that the error is gone :-)