You are here

function views_plugin_ds_entity_view::ds_views_3_support in Display Suite 7.2

Same name and namespace in other branches
  1. 7 views/views_plugin_ds_entity_view.inc \views_plugin_ds_entity_view::ds_views_3_support()
1 call to views_plugin_ds_entity_view::ds_views_3_support()
views_plugin_ds_entity_view::init in views/views_plugin_ds_entity_view.inc

File

views/views_plugin_ds_entity_view.inc, line 29
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 ds_views_3_support() {
  if (strpos($this->base_table, 'eck_') === 0) {

    // Base tables of entities created by entity construction kit (eck)
    // are prefixed with 'eck_' and the base field is always 'id'.
    $this->entity_type = str_replace('eck_', '', $this->base_table);
    return 'id';
  }
  $base_table_fields = array(
    'node' => array(
      'field' => 'nid',
      'entity_type' => 'node',
    ),
    'comment' => array(
      'field' => 'cid',
      'entity_type' => 'comment',
    ),
    'users' => array(
      'field' => 'uid',
      'entity_type' => 'user',
    ),
    'apachesolr' => array(
      'field' => 'nid',
      'entity_type' => 'node',
    ),
    'taxonomy_term_data' => array(
      'field' => 'tid',
      'entity_type' => 'taxonomy_term',
    ),
    'file_managed' => array(
      'field' => 'fid',
      'entity_type' => 'file',
    ),
    'micro' => array(
      'field' => 'mid',
      'entity_type' => 'micro',
    ),
  );
  $this->entity_type = isset($base_table_fields[$this->base_table]) ? $base_table_fields[$this->base_table]['entity_type'] : 'node';
  return isset($base_table_fields[$this->base_table]) ? $base_table_fields[$this->base_table]['field'] : 'nid';
}