An exposed filter is not visible on a but I receive notices and warnings below.
This occurs also when there is a filter block visible on a page.

Notice: Undefined index: tokens in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 525 of /***/sites/all/modules/contrib/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).
Warning: in_array() expects parameter 2 to be array, null given in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 526 of /***/sites/all/modules/contrib/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).
Notice: Undefined index: tokens in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 525 of /***/sites/all/modules/contrib/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).
Warning: in_array() expects parameter 2 to be array, null given in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 526 of /***/sites/all/modules/contrib/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).
Notice: Undefined index: tokens in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 525 of /***/sites/all/modules/contrib/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).
Warning: in_array() expects parameter 2 to be array, null given in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 526 of /***/sites/all/modules/contrib/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).
Notice: Undefined index: tokens in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 525 of /***/sites/all/modules/contrib/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).
Warning: in_array() expects parameter 2 to be array, null given in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 526 of /***/sites/all/modules/contrib/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc).

Drupal 7.12

Comments

Refineo’s picture

Title: Undefined index notices and warnings but no exposed filter on a page » Token replacement on BEF Description fields doesn't work

I modified the title so it reflects the problem more precisely.

In this case there is no $options['more_options']['tokens'] under $options['more_options'] at all.

Refineo’s picture

Title: Token replacement on BEF Description fields doesn't work » Token replacement on BEF Description fields show warnings when no tokens are used

I found out that these warnings and notices are showing only if there are no tokens used inside the BEF configuration.
It should be easy to correct this with sth like:

if ( isset($options['more_options']['tokens']) ... ) {

  code
}
KLicheR’s picture

I made a patch of the suggestion at #2.
It work on 7.x-3.0-beta3.

renat’s picture

Status: Active » Needs review

For me patch from #3 works just fine, and it's code looks reasonable.

mgifford’s picture

Agreed. It's just wrapping it in if (isset($options['more_options']['tokens'])) {

Seems really safe.

PuntoAndroid’s picture

Status: Needs review » Fixed

It worked for me ! Great contribution!!!

renat’s picture

Status: Fixed » Reviewed & tested by the community

@PuntoAndroid, as far as I understand, patch is not committed yet, right? If so, we should make it "RTBC" rather than "fixed".

mikeker’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the bug report and patches. But the real solution is to set the correct default value. Note that this only happens for existing views that were built before the token replacement code was added and then the BEF code was updated.

Regardless, a fix has been committed. My apologies for the delay in resolving this issue.

Status: Fixed » Closed (fixed)

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

shaysmith’s picture

Resolved this without the patch by opening affected views, viewing the BEF settings and saving out of the settings and view.

Any info on when the updated module might be out, would be nice though.

mikeker’s picture

@shaysmith, these changes are available in the latest -dev release.

I'll probably be rolling a "real" release in the next few weeks -- I've got a few more issues I want to close first.

leistiko_texvet’s picture

Thanks to shaysmith for, "Resolved this without the patch by opening affected views, viewing the BEF settings and saving out of the settings and view."

For people who need a little more of an explanation for the fix than the above (like me, about 40 minutes ago...), I made a very short (<30 seconds) movie of me following the recommended steps:

http://screencast.com/t/eCezdC5Mb7

I hope this helps...

leistiko_texvet’s picture

Issue summary: View changes

This occurs also when there is a filter block visible on a page.