You are here

function vefl_preprocess_views_exposed_widget in Views exposed form layout 7

A theme preprocess function for views_exposed_widget.

File

includes/vefl.inc, line 88
Provides default layouts for views exposed form.

Code

function vefl_preprocess_views_exposed_widget(&$vars) {
  $vars['widget']->id = str_replace('_', '-', $vars['widget']->id);
  $vars['classes_array'][] = 'views-widget-' . $vars['widget']->id;

  // Adds classes like in default views template.
  if ($vars['widget']->id == 'button') {
    $vars['classes_array'][] = 'views-submit-button';
  }
  if ($vars['widget']->id == 'reset-button') {
    $vars['classes_array'][] = 'views-reset-button';
  }

  // Adds widget theme suggestions.
  $field_name = str_replace('-', '_', $vars['widget']->id);
  if (substr($field_name, 0, 5) == 'edit_') {
    $field_name = substr($field_name, 5);
  }

  // @todo: add suggestion by views name and display.
  $vars['theme_hook_suggestions'][] = 'views_exposed_widget__' . $field_name;
}