Hi,

I have made a couple of views with views, BEF and Display suite but I get the following error message.

Notice: Undefined index: label in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 906 of .../sites/all/modules/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).
Notice: Undefined index: label in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 906 of .../sites/all/modules/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).
Notice: Undefined index: label in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 906 of .../sites/all/modules/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).
Notice: Undefined index: label in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 906 of .../sites/all/modules/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).

The view is set to display Display suite elements and I use an exposed filters on block. I get exactly the same on a similar view with maps but when I choose to show fields instead of DS elements, the notifications disappear.

Any ideas what could be causing this and what can I do to fix it?

If you need any further info just ask.

Thanks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

trevorkjorlien’s picture

I'm getting this error too, but I don't think it's related to Display Suite. Line 906 in the file is:

$secondary[$identifier]['#title'] = $form['#info']["filter-$label"]['label'];

This issue discusses the label of the Secondary Options form: #1852306: Text of the "Secondary options label" cannot be translated. Are you using the Secondary Options form in one of your Views but not the other?

mikeker’s picture

Status: Active » Postponed (maintainer needs more info)

Please include an export of the View in question. Otherwise there's no way for me to know the details of your situation.

Thanks.

funkycamel’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Active
FileSize
502.71 KB
516.15 KB
18.9 KB
15.16 KB

Please find attached views exports and screenshots of the output.

Thanks in advance.

funkycamel’s picture

I use secondary options on both variations. You can have a look.

http://malta-home.com/commercial#overlay-context=
This is the one that it prompts me the message.

When I show fields instead of DS elements the error disappears

And here is another view with the same filters plus more (default taxonomy view- uses default contextual filters). No error.

funkycamel’s picture

Status: Active » Closed (duplicate)

When I activate the secondary options it happens. I guess it is the same with https://drupal.org/node/1852306.

So I guess beside that quick fix there isn't anything else so far. Better than nothing I guess.

Thank you all.
funkycamel

miromarchi’s picture

Hi, I see the same notice:

Notice: Undefined index: label in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 906 of /better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc)

I don't use DS.
I use BEF setting "Enable secondary exposed form options" with a custom label.
I don't use exposed form setting "Exposed form in block".
I've tried changing line 372 as suggested by ptmkenny in https://drupal.org/comment/7032098#comment-7032098 but I couln'd get rid of the notice.

anschultz’s picture

In better_exposed_filters_exposed_form_plugin.inc there are some unset($form['#info']["filter-$label"]['label']); inside the foreach ($settings as $label => $options) above where the secondary elements are evaluated. Meaning that if you are using radio buttons or checkboxes in a collapsible fieldset, then the 'label' is getting unset before it can be indexed in line 906, thus the error messages.

I fixed it by tracking the 'label' with a temporary variable and changing how $secondary[$identifier]['#title'] in line 906 is set.

anschultz’s picture

Status: Closed (duplicate) » Needs review
anschultz’s picture

I have a patch, but I'm not sure how to attach it here. I changed the status to 'needs review' per https://drupal.org/patch/submit, but I'm still not seeing any options. Anybody know?

mikeker’s picture

Status: Needs review » Postponed (maintainer needs more info)

@anschultz: You need to click the "Update this issue" link to change status or attach a patch to an issue. Make sure to change the status to "Need review" to trigger the testbot to run your patch through the usual bank of tests.

Thanks.

anschultz’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
1.89 KB

Status: Needs review » Needs work

The last submitted patch, 11: better_exposed_filters-undef_index_label_fix-2050537-7.patch, failed testing.

mikeytown2’s picture

Status: Needs work » Needs review

Encountering something similar and have a fix.

Notice: Undefined index: filter-field_basic_primarylocation_administrative_area in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 896 of better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).

This should help explain what is wrong: Debug output below.

Array (
    [$form['#info']] => Array (
            [filter-field_basic_mrkgrp_tid] => Array (
                    [operator] => field_basic_mrkgrp_tid_op
                    [value] => cat
                    [label] => Business Type
                    [description] => ''
                )
            [filter-state] => Array (
                    [value] => state
                    [label] => State
                    [description] => ''
                )
        )
    [$filters[$label]->options['group_info']['identifier']] => field_basic_mrkgrp_tid
    [$label] => field_basic_mrkgrp_tid
)
Array (
    [$form['#info']] => Array (
            [filter-field_basic_mrkgrp_tid] => Array (
                    [operator] => field_basic_mrkgrp_tid_op
                    [value] => cat
                    [label] => Business Type
                    [description] => ''
                )
            [filter-state] => Array (
                    [value] => state
                    [label] => State
                    [description] => ''
                )
        )
    [$filters[$label]->options['group_info']['identifier']] => state
    [$label] => field_basic_primarylocation_administrative_area

This
$field_id = $form['#info']["filter-$label"]['value'];
should be this
$field_id = $form['#info']["filter-{$filters[$label]->options['group_info']['identifier']}"]['value'];

mikeytown2’s picture

Status: Needs review » Needs work

The last submitted patch, 14: better_exposed_filters-2050537-14-fix-php-notice.patch, failed testing.

mikeytown2’s picture

Version: 7.x-3.0-beta3 » 7.x-3.x-dev
Status: Needs work » Needs review
mikeytown2’s picture

mikeytown2’s picture

Using the new way as a fallback in case the old way doesn't work.

  • Commit f288549 on 7.x-3.x authored by mikeytown2, committed by mikeker:
    Issue #2050537 by mikeytown2, funkycamel, anschultz: Notification...
mikeker’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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