vocabulary.inc File Reference

(1.1.2.6 2008/06/03 13:18:07 pancho)


Detailed Description

Plugin to provide a vocabulary context

Definition in file vocabulary.inc.

Go to the source code of this file.

Functions

 panels_context_create_vocabulary ($empty, $data=NULL, $conf=FALSE)
 panels_context_vocabulary_settings_form ($conf, $external=FALSE)
 panels_vocabulary_panels_contexts ()


Function Documentation

panels_context_create_vocabulary ( empty,
data = NULL,
conf = FALSE 
)

It's important to remember that $conf is optional here, because contexts are not always created from the UI.

Definition at line 28 of file vocabulary.inc.

00028                                                                                {
00029   $context = new panels_context('vocabulary');
00030   $context->plugin = 'vocabulary';
00031 
00032   if ($empty) {
00033     return $context;
00034   }
00035 
00036   if ($conf) {
00037     $data = taxonomy_get_vocabulary($data['vid']);
00038   }
00039 
00040   if (!empty($data)) {
00041     $context->data     = $data;
00042     $context->title    = $data->name;
00043     $context->argument = $data->vid;
00044     return $context;
00045   }
00046 }

panels_context_vocabulary_settings_form ( conf,
external = FALSE 
)

Definition at line 48 of file vocabulary.inc.

00048                                                                            {
00049   $options = array();
00050   if ($external) {
00051     $options[0] = t('External source');
00052   }
00053 
00054   foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
00055     $options[$vid] = $vocabulary->name;
00056   }
00057 
00058   $form['vid'] = array(
00059     '#title' => t('Vocabulary'),
00060     '#type' => 'select',
00061     '#options' => $options,
00062     '#default_value' => $conf['vids'],
00063     '#prefix' => '<div class="clear-block">',
00064     '#suffix' => '</div>',
00065     '#description' => t('Select the vocabulary for this form.'),
00066   );
00067   if ($external) {
00068     $form['vid']['#description'] .= ' ' . t('Select external to require this from an external source (such as a containing panel page).');
00069   }
00070 
00071   return $form;
00072 }

panels_vocabulary_panels_contexts (  ) 

Definition at line 11 of file vocabulary.inc.

00011                                              {
00012   $args['vocabulary'] = array(
00013     'title' => t("Taxonomy vocabulary"),
00014     'description' => t('A single taxonomy vocabulary object.'),
00015     'context' => 'panels_context_create_vocabulary',
00016     'settings form' => 'panels_context_vocabulary_settings_form',
00017     'settings form validate' => 'panels_context_vocabulary_settings_form_validate',
00018     'keyword' => 'vocabulary',
00019     'context name' => 'vocabulary',
00020   );
00021   return $args;
00022 }


Generated on Thu Jul 29 05:00:16 2010 for Panels 2 by  doxygen 1.5.6