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.
When including an exposed filter in the secondary exposed form options using BEF, the exposed operator is left out.
Here is a simple view to demonstrate this. Notice that the exposed Nid filter gets included in the advanced dropdown but it's operator (e.g "is equal to, is between, regular expression etc...") is left out of the collapsible fieldset.
$view = new view();
$view->name = 'bef_exposed_operator_bug';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'bef_exposed_operator_bug';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'bef_exposed_operator_bug';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'better_exposed_filters';
$handler->display->display_options['exposed_form']['options']['bef'] = array(
'general' => array(
'allow_secondary' => 1,
'secondary_label' => 'Advanced options',
),
'nid' => array(
'bef_format' => 'default',
'more_options' => array(
'is_secondary' => 1,
'bef_filter_description' => '',
'tokens' => array(
'available' => array(
0 => 'global_types',
),
),
'rewrite' => array(
'filter_rewrite_values' => '',
),
),
),
);
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 'All';
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['exposed'] = TRUE;
$handler->display->display_options['filters']['status']['expose']['operator_id'] = '';
$handler->display->display_options['filters']['status']['expose']['label'] = 'Published';
$handler->display->display_options['filters']['status']['expose']['operator'] = 'status_op';
$handler->display->display_options['filters']['status']['expose']['identifier'] = 'status';
$handler->display->display_options['filters']['status']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
3 => 0,
);
/* Filter criterion: Content: Nid */
$handler->display->display_options['filters']['nid']['id'] = 'nid';
$handler->display->display_options['filters']['nid']['table'] = 'node';
$handler->display->display_options['filters']['nid']['field'] = 'nid';
$handler->display->display_options['filters']['nid']['exposed'] = TRUE;
$handler->display->display_options['filters']['nid']['expose']['operator_id'] = 'nid_op';
$handler->display->display_options['filters']['nid']['expose']['label'] = 'Nid';
$handler->display->display_options['filters']['nid']['expose']['use_operator'] = TRUE;
$handler->display->display_options['filters']['nid']['expose']['operator'] = 'nid_op';
$handler->display->display_options['filters']['nid']['expose']['identifier'] = 'nid';
$handler->display->display_options['filters']['nid']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
3 => 0,
);
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['path'] = 'bef-exposed-operator-bug';
Comment | File | Size | Author |
---|---|---|---|
#8 | bef-exposed-operators-secondary-form-1869082-8.patch | 975 bytes | berliner |
Picture 18.png | 20.83 KB | pixelsweatshop |
Comments
Comment #0.0
pixelsweatshop CreditAttribution: pixelsweatshop commentedrewording for better clarification.
Comment #1
nigelw CreditAttribution: nigelw commentedI can confirm that this indeed a bug. I am seeing this as well.
Comment #2
mikeker CreditAttribution: mikeker commentedFixed.
Thanks for the bug report and sorry about the delay.
Comment #3
pixelsweatshop CreditAttribution: pixelsweatshop commentedThanks for looking at this mikeker. Unfortunately after testing the exposed operator is still left out.
Here is an export of a view (using latest BEF dev version) that demonstrates it.
Comment #4
heddnI can confirm that is is also an issue. Was this only fixed in Dev? If so, can we get a patch so I can apply it to stable?
Comment #5
heddnMore information. This only seems to be an issue if I don't list a label for the secondary options.
Comment #5.0
heddntypo
Comment #6
narkoff CreditAttribution: narkoff commentedI'm having this same issue. Was there ever any resolution to this?
Comment #7
narkoff CreditAttribution: narkoff commentedThis issue states that it's fixed (https://drupal.org/node/1297418). I'm running 7.x-3.0-beta3+38-dev.
Comment #8
berliner CreditAttribution: berliner commentedThe attached patch should fix a problem with wrong references in code, that result in the described problem.
Patch is against the latest dev.
Comment #9
narkoff CreditAttribution: narkoff commentedI have tested against 7.x-3.0-beta3+38-dev. This patch fixes this issue. Thank you berliner!
Comment #10
berliner CreditAttribution: berliner commented@mikeker: What do you think? Simple patch? Could be RTBC already?
Comment #11
miromarchi CreditAttribution: miromarchi commentedthanks fot the patch in #8, working for me.
Sorry to bother with a minor issue, but the result is that the exposed operator is displayed above the exposed filter label. Shouldn't it be displayed below the exposed filter label?
Thanks
Comment #12
berliner CreditAttribution: berliner commentedThat sounds like a different issue that is not even related to BEF. Maybe open an issue in the views issue queue?
Comment #13
mikeker CreditAttribution: mikeker commentedThank you to @nicoz for including the export in your bug report and @berliner for the patch. It's been committed.
Comment #14
mikeker CreditAttribution: mikeker commented