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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Ok, I think the button simply lost its name.
If you check before line 4085 and add this

  if (!isset($types[$type])) {
    $types[$type]['ltitle'] = t('this');
  }

Then it works, but of course this is not the right approach. I dont know why that button lost its name

Anonymous’s picture

This is still a bug in today's latest devx.

Anonymous’s picture

Title: Undefined index: area in views_ui_add_item_form() on line 4085 » Can't add header or footer content to view
neoglez’s picture

Status: Active » Postponed (maintainer needs more info)

This is still a bug in today's latest devx.

I 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??

magnusk’s picture

Status: Postponed (maintainer needs more info) » Active

I 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).

dawehner’s picture

Is it possible that someone can describe how to reproduce the problem.

Just some steps: a-f would really really help to fix the problem.

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

Unable 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?

David Sparks’s picture

I'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().

neoglez’s picture

Assigned: Unassigned » neoglez
Status: Postponed (maintainer needs more info) » Active

@ 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 ;)

willieseabrook’s picture

I 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.

dawehner’s picture

neoglez’s picture

Status: Active » Needs review
FileSize
660 bytes

@ dereine To be able to reproduce turn of JS in the browser. I'm not using Devel.
(also by fallowing the logic in #8)

R13ose’s picture

I tried this patch, and this works for me. I was able to edit header and footer of views now.

dawehner’s picture

Status: Needs review » Fixed

Commited 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

neoglez’s picture

It's OK, the most important is that the error is gone :-)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.