You are here

function context_condition_views::condition_values in Context 6

Same name and namespace in other branches
  1. 6.3 plugins/context_condition_views.inc \context_condition_views::condition_values()
  2. 7.3 plugins/context_condition_views.inc \context_condition_views::condition_values()

Generate a list of database and module provided views.

Overrides context_condition::condition_values

File

plugins/context_condition_views.inc, line 8

Class

context_condition_views

Code

function condition_values() {
  $enabled_views = array();
  $views = views_get_all_views();
  ksort($views);
  foreach ($views as $view) {
    if (!isset($views[$view->name]->disabled) || !$views[$view->name]->disabled) {
      $enabled_views[$view->name] = check_plain($view->name);

      // Provide more granular options for each page display
      $displays = array();
      foreach ($view->display as $id => $display) {
        if ($display->display_plugin == 'page') {
          $displays[$view->name . ":" . $id] = check_plain("-- {$display->display_title}");
        }
      }
      $enabled_views += $displays;
    }
  }
  return $enabled_views;
}