You are here

function views_plugin_ds_entity_view::pre_render in Display Suite 7

Same name and namespace in other branches
  1. 7.2 views/views_plugin_ds_entity_view.inc \views_plugin_ds_entity_view::pre_render()

Preload all entities.

Overrides views_plugin_row::pre_render

File

views/views_plugin_ds_entity_view.inc, line 248
Provides the Display suite views entity style plugin.

Class

views_plugin_ds_entity_view
Plugin which defines the view mode on the resulting entity object.

Code

function pre_render($values) {
  $ids = array();
  foreach ($values as $row) {
    $ids[] = $row->{$this->field_alias};
  }
  switch ($this->base_table) {
    case 'node':
      $this->entities = node_load_multiple($ids);
      break;
    case 'comment':
      $this->entities = comment_load_multiple($ids);
      break;
    case 'users':
      $this->entities = user_load_multiple($ids);
      break;
    case 'taxonomy_term_data':
      $this->entities = taxonomy_term_load_multiple($ids);
      if (function_exists('i18n_taxonomy_localize_terms')) {
        global $language;
        foreach ($this->entities as $index => &$entity) {
          $entity = i18n_taxonomy_localize_terms($entity, $language->language);
        }
      }
      break;
    case 'file_managed':
      $this->entities = file_load_multiple($ids);
      break;
    case 'micro':
      $this->entities = entity_load($this->base_table, $ids);
      break;
  }
}