You are here

function context_ui_contrib_context_items in Context 5

Implementation of hook_context_items()

File

context_ui/context_ui_contrib.module, line 6

Code

function context_ui_contrib_context_items() {
  $items = array();

  // Views
  if (module_exists('views')) {
    $items['views'] = array(
      '#title' => t('Views'),
      '#description' => t('Set this context when displaying the page of one of these views.'),
      '#options' => _context_ui_contrib_get_views(),
      '#type' => 'checkboxes',
      '#context_ui' => 'setter',
    );
  }

  // Nodequeue
  if (module_exists('nodequeue')) {
    $result = db_query("SELECT qid, title FROM {nodequeue_queue}");
    $options = array();
    while ($nq = db_fetch_object($result)) {
      $options[$nq->qid] = $nq->title;
    }
    $items['nodequeue'] = array(
      '#title' => t('Nodequeue'),
      '#description' => t('Set this context when a node in the selected nodequeue(s) is viewed.'),
      '#options' => $options,
      '#type' => 'checkboxes',
      '#context_ui' => 'setter',
    );
  }

  // Outline
  if (module_exists('outline')) {
    $result = db_query("SELECT volume_id, title FROM {outline_volume}");
    $options = array();
    while ($vol = db_fetch_object($result)) {
      $options[$vol->volume_id] = $vol->title;
    }
    $items['outline'] = array(
      '#title' => t('Outline'),
      '#description' => t('Set this context when a node in the selected volumes(s) is viewed.'),
      '#options' => $options,
      '#type' => 'checkboxes',
      '#context_ui' => 'setter',
    );
  }
  return $items;
}