You are here

function ctools_vid_context in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 plugins/arguments/vid.inc \ctools_vid_context()

Discover if this argument gives us the vocabulary we crave.

1 string reference to 'ctools_vid_context'
vid.inc in plugins/arguments/vid.inc
Plugin to provide an argument handler for a vocabulary id

File

plugins/arguments/vid.inc, line 28
Plugin to provide an argument handler for a vocabulary id

Code

function ctools_vid_context($arg = NULL, $conf = NULL, $empty = FALSE) {

  // If unset it wants a generic, unfilled context.
  if ($empty) {
    return ctools_context_create_empty('vocabulary');
  }
  if (!is_numeric($arg)) {
    return NULL;
  }
  $vocabulary = taxonomy_vocabulary_load($arg);
  if (!$vocabulary) {
    return NULL;
  }
  return ctools_context_create('vocabulary', $vocabulary);
}