You are here

public function PanelizerEntityDefault::preprocess_panelizer_view_mode in Panelizer 7.3

Preprocess the entity view mode template.

1 call to PanelizerEntityDefault::preprocess_panelizer_view_mode()
PanelizerEntityNode::preprocess_panelizer_view_mode in plugins/entity/PanelizerEntityNode.class.php
Preprocess the entity view mode template.
1 method overrides PanelizerEntityDefault::preprocess_panelizer_view_mode()
PanelizerEntityNode::preprocess_panelizer_view_mode in plugins/entity/PanelizerEntityNode.class.php
Preprocess the entity view mode template.

File

plugins/entity/PanelizerEntityDefault.class.php, line 3677
Base class for the Panelizer Entity plugin.

Class

PanelizerEntityDefault
Base class for the Panelizer Entity plugin.

Code

public function preprocess_panelizer_view_mode(&$vars, $entity, $element, $panelizer, $info) {
  $vars['classes_array'][] = drupal_html_class($this->entity_type);
  $vars['classes_array'][] = drupal_html_class($this->entity_type . '-' . $element['#view_mode']);
  $vars['classes_array'][] = drupal_html_class($this->entity_type . '-' . $element['#panelizer_bundle']);
  $vars['classes_array'][] = drupal_html_class($this->entity_type . '-' . $element['#panelizer_entity_id']);
  if (!empty($entity->preview)) {
    $vars['classes_array'][] = drupal_html_class($this->entity_type . '-preview');
  }
  if (!empty($panelizer->title_element)) {
    $vars['title_element'] = $panelizer->title_element;
  }
  else {
    $vars['title_element'] = 'h2';
  }
  $vars['content'] = $info['content'];
  if (!empty($info['title'])) {
    $vars['title'] = $info['title'];
  }
  if (!empty($info['classes_array'])) {
    $vars['classes_array'] = array_merge($vars['classes_array'], $info['classes_array']);
  }
  if (!empty($panelizer->link_to_entity)) {
    list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
    $bits = explode('/', $this->plugin['entity path']);
    foreach ($bits as $count => $bit) {
      if (strpos($bit, '%') === 0) {
        $bits[$count] = $entity_id;
      }
    }
    $vars['entity_url'] = url(implode('/', $bits));
  }
}