You are here

function eva_plugin_display_entity::options_summary in EVA: Entity Views Attachment 7

Provide the summary for page options in the views UI.

This output is returned as an array.

Overrides views_plugin_display::options_summary

File

./eva_plugin_display_entity.inc, line 30

Class

eva_plugin_display_entity
The plugin that handles entity-attached views.

Code

function options_summary(&$categories, &$options) {

  // It is very important to call the parent function here:
  parent::options_summary($categories, $options);
  $categories['entity_view'] = array(
    'title' => t('Entity content settings'),
    'column' => 'second',
    'build' => array(
      '#weight' => -10,
    ),
  );
  if ($entity_type = $this
    ->get_option('entity_type')) {
    $entity_info = entity_get_info($entity_type);
    $type_name = $entity_info['label'];
    $bundle_names = array();
    foreach ($this
      ->get_option('bundles') as $bundle) {
      $bundle_names[] = $entity_info['bundles'][$bundle]['label'];
    }
  }
  $options['entity_type'] = array(
    'category' => 'entity_view',
    'title' => t('Entity type'),
    'value' => empty($type_name) ? t('None') : $type_name,
  );
  $options['bundles'] = array(
    'category' => 'entity_view',
    'title' => t('Bundles'),
    'value' => empty($bundle_names) ? t('All') : implode(', ', $bundle_names),
  );
  $options['show_on'] = array(
    'category' => 'entity_view',
    'title' => t('Show on'),
    'value' => $this
      ->get_option('show_on'),
  );
  $argument_mode = $this
    ->get_option('argument_mode');
  $options['arguments'] = array(
    'category' => 'entity_view',
    'title' => t('Arguments'),
    'value' => empty($argument_mode) ? t('None') : check_plain($argument_mode),
  );
  $options['show_title'] = array(
    'category' => 'entity_view',
    'title' => t('Show title'),
    'value' => $this
      ->get_option('show_title') ? t('Yes') : t('No'),
  );
  $options['exposed_form_as_field'] = array(
    'category' => 'entity_view',
    'title' => t('Exposed Form as Field'),
    'value' => $this
      ->get_option('exposed_form_as_field') ? t('Yes') : t('No'),
  );
  if (module_exists('token')) {

    // We must load token values here to show them on the options form.
    drupal_add_js(drupal_get_path('module', 'token') . '/token.js');
    drupal_add_css(drupal_get_path('module', 'token') . '/token.css');
    drupal_add_library('token', 'treeTable');
  }
}