HTTP AJAX Error when adding and configuring fields (or doing anything else in a dialog)
Closed this issue · 4 comments
Here's an example error:
https://skitch.com/jesse.beach/rxhkg/something-content-drupal-development
Steps to reproduce:
- Create a view and edit it
- Click "add" to add filter criteria
- Select a few criteria
- Click "Add and configure filter criteria"
- The AJAX error should appear.
The error is:
ResponseText: Recoverable fatal error: Argument 1 passed to drupal_attributes() must be an array, null given, called in /Users/macbookpro/Sites/ui/includes/form.inc on line 3107 and defined in drupal_attributes() (line 2258 of /includes/common.inc).
It comes from theme_container(), where it $element['#attributes'] isn't initialized correctly:
return '<div' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '';
I fixed it with this commit:
63666a3
If I understand correctly, this is using some ctools functionality? Perhaps the bug is there. It only failed here because all other elements already had some declared #attributes.
I don't see anything ctools there. container is core, I think.
True, the ctools collapsible is in JS.
So I guess the only question is why the #attributes don't get correctly initialized, requiring us to do it ourselves.
Leaving this issue open if someone gets an epiphany, in any case the bug is gone.
Core bug. theme_container() initializes #attributes (by adding id/class) when $element is in a form (i.e., when there's a #array_parents). In the case above, 'container' is used a #theme_wrapper for an element that isn't in a form. Might be good to submit a core patch to theme_container() to handle an uninitialized #attributes when $element isn't in a form. Anyway, fixed in Views UI, so closing issue.