function 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

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('entity:taxonomy_vocabulary');
  }
  if (!is_numeric($arg)) {
    return NULL;
  }
  $vocabulary = taxonomy_vocabulary_load($arg);
  if (!$vocabulary) {
    return NULL;
  }
  return ctools_context_create('vocabulary', $vocabulary);
}