You are here

function better_exposed_filters_theme_suggestions_alter in Better Exposed Filters 8.4

Same name and namespace in other branches
  1. 8.5 includes/better_exposed_filters.theme.inc \better_exposed_filters_theme_suggestions_alter()

Implements hook_theme_suggestions_alter().

File

includes/better_exposed_filters.theme.inc, line 35
Theme hooks, preprocessor, and suggestions.

Code

function better_exposed_filters_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {

  // Target bef elements.
  if ($hook === 'form_element') {
    $plugin_type = $variables['element']['#context']['plugin_type'] ?? FALSE;
    if ($plugin_type && $plugin_type === 'bef') {
      $view_id = $variables['element']['#context']['#view_id'];
      $display_id = $variables['element']['#context']['#display_id'];
      if ($view_id) {
        $suggestions[] = $hook . '__' . $view_id;
        if ($display_id) {
          $suggestions[] = $hook . '__' . $view_id . '__' . $display_id;
        }
      }
    }
  }
}