term_from_node.inc File Reference

(1.1.2.5 2008/05/27 20:21:14 sdboyer)


Detailed Description

Plugin to provide an relationship handler for term from node

Definition in file term_from_node.inc.

Go to the source code of this file.

Functions

 panels_term_from_node_context ($context=NULL, $conf)
 panels_term_from_node_panels_relationships ()
 panels_term_from_node_settings_form ($conf)


Function Documentation

panels_term_from_node_context ( context = NULL,
conf 
)

Return a new context based on an existing context

Definition at line 27 of file term_from_node.inc.

References panels_context_create(), and panels_context_create_empty().

00027                                                                {
00028   // If unset it wants a generic, unfilled context, which is just NULL
00029   if (empty($context->data)) {
00030     return panels_context_create_empty('term', NULL);
00031   }
00032 
00033   if (isset($context->data->taxonomy)) {
00034     foreach ($context->data->taxonomy as $term) {
00035       if ($term->vid == $conf['vid']) {
00036         return panels_context_create('term', $term);
00037       }
00038     }
00039   }
00040 }

Here is the call graph for this function:

panels_term_from_node_panels_relationships (  ) 

Definition at line 11 of file term_from_node.inc.

00011                                                       {
00012   $args['term_from_node'] = array(
00013     'title' => t("Term from node"),
00014     'keyword' => 'term',
00015     'description' => t('Adds a taxonomy term from a node context; if multiple terms are selected, this will get the "first" term only.'),
00016     'required context' => new panels_required_context(t('Node'), 'node'),
00017     'context' => 'panels_term_from_node_context',
00018     'settings form' => 'panels_term_from_node_settings_form',
00019     'settings form validate' => 'panels_term_from_node_settings_form_validate',
00020   );
00021   return $args;
00022 }

panels_term_from_node_settings_form ( conf  ) 

Settings form for the relationship

Definition at line 45 of file term_from_node.inc.

00045                                                     {
00046   $options = array();
00047   foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
00048     $options[$vid] = $vocabulary->name;
00049   }
00050   $form['vid'] = array(
00051     '#title' => t('Vocabulary'),
00052     '#type' => 'select',
00053     '#options' => $options,
00054     '#default_value' => $conf['vid'],
00055     '#prefix' => '<div class="clear-block">',
00056     '#suffix' => '</div>',
00057   );
00058 
00059   return $form;
00060 }


Generated on Sun Feb 5 05:00:25 2012 for Panels 2 by  doxygen 1.5.6