You are here

function template_preprocess_eva_display_entity_view in EVA: Entity Views Attachment 8

Same name and namespace in other branches
  1. 8.2 eva.module \template_preprocess_eva_display_entity_view()
  2. 7 eva.theme.inc \template_preprocess_eva_display_entity_view()

templating preprocessing figure out the title and whether there's an exposed form

File

./eva.module, line 291
Module implementing EVA extra field and views display

Code

function template_preprocess_eva_display_entity_view(&$variables) {
  $view = $variables['view'];
  $display = $view->display_handler;
  $variables['title'] = $display
    ->getOption('show_title') ? Xss::filterAdmin($view
    ->getTitle()) : '';
  $variables['exposed_form_as_field'] = $display
    ->getOption('exposed_form_as_field');
  $id = $view->storage
    ->id();
  $variables['css_name'] = Html::cleanCssIdentifier($id);
  $variables['id'] = $id;
  $variables['display_id'] = $view->current_display;
  $variables['dom_id'] = $view->dom_id;

  // pull in the display class
  $css_class = $view->display_handler
    ->getOption('css_class');
  if (!empty($css_class)) {
    $variables['css_class'] = preg_replace('/[^a-zA-Z0-9- ]/', '-', $css_class);
    $variables['attributes']['class'][] = $variables['css_class'];
  }
  $variables['view_array']['#view_id'] = $view->storage
    ->id();
  $variables['view_array']['#view_display_show_admin_links'] = $view
    ->getShowAdminLinks();
  $variables['view_array']['#view_display_plugin_id'] = $display
    ->getPluginId();
  views_add_contextual_links($variables['view_array'], 'view', $display
    ->getLinkDisplay());
}