12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- $plugin = array(
- 'title' => t("Vocabulary: ID"),
-
- 'keyword' => 'vocabulary',
- 'description' => t('Creates a vocabulary context from a vocabulary ID argument.'),
- 'context' => 'ctools_vid_context',
- 'placeholder form' => array(
- '#type' => 'textfield',
- '#description' => t('Enter the vocabulary ID for this argument'),
- ),
- 'no ui' => TRUE,
- );
- function ctools_vid_context($arg = NULL, $conf = NULL, $empty = FALSE) {
-
- 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);
- }
|