You are here

function references_get_views_options in References 7.2

Get Views Options.

Retrieves the list of views with a 'references' display, in a format suitable for a 'select' form element..

Parameters

string $entity_type: The entity type.

Return value

array An array of eligible views displays.

2 calls to references_get_views_options()
node_reference_field_settings_form in node_reference/node_reference.module
Implements hook_field_settings_form().
user_reference_field_settings_form in user_reference/user_reference.module
Implements hook_field_settings_form().

File

./references.module, line 108
Defines common base features for the various reference field types.

Code

function references_get_views_options($entity_type) {

  // Filter views that contain a 'references' display. This actually returns a
  // list of displays (the same view appears several times).
  $displays = views_get_applicable_views('references display');

  // Filter views that list the entity type we want, and group the separate
  // displays by view.
  $entity_info = entity_get_info($entity_type);
  $options = array();
  foreach ($displays as $data) {
    list($view, $display_id) = $data;
    if ($view->base_table == $entity_info['base table']) {
      $options[$view->name . ':' . $display_id] = $view->name . ' - ' . $view->display[$display_id]->display_title;
    }
  }
  return $options;
}