You are here

function references_dialog_get_search_views in References dialog 7

Get all search views that are available for a particular attachable.

Parameters

string $attachable: The name of the attachable to look for.

Return value

array

2 calls to references_dialog_get_search_views()
references_dialog_field_get_search_views in ./references_dialog.module
Get search views attached to a particular field instance.
references_dialog_get_views_search_links in ./references_dialog.module
Get all views search links for an instance. This function should be used by references dialog widgets that uses views for it's search functionality.

File

./references_dialog.module, line 132
This the main module file.

Code

function references_dialog_get_search_views($attachable) {
  $search_views =& drupal_static(__FUNCTION__, array());
  if (!isset($search_views[$attachable])) {
    $search_views[$attachable] = array();

    // Get all views that has a references_dialog display.
    $results = references_dialog_get_applicable_views();
    foreach ($results as $view_name => $result) {
      foreach ($result as $display_name => $result_displays) {
        foreach ($result_displays['attachables'] as $name => $view_attachable) {
          if ($attachable == $view_attachable) {
            $search_views[$attachable][$view_name] = $result_displays;
          }
        }
      }
    }
  }
  return $search_views[$attachable];
}