term_list.inc File Reference

(1.1.2.9 2008/05/27 20:21:11 sdboyer)

Go to the source code of this file.

Functions

 panels_admin_content_types_term_list ()
 panels_admin_edit_term_list ($id, $parents, $conf=array())
 panels_admin_term_list_options ()
 panels_admin_title_term_list ($conf, $context)
 panels_content_term_list ($conf, $panel_args, $context)
 panels_term_list_panels_content_types ()


Function Documentation

panels_admin_content_types_term_list (  ) 

Return all content types available.

Definition at line 79 of file term_list.inc.

References panels_get_path().

00079                                                 {
00080   return array(
00081     'description' => array(
00082       'title' => t('List of related terms'),
00083       'icon' => 'icon_node.png',
00084       'path' => panels_get_path('content_types/node'),
00085       'description' => t('Terms related to an existing term; may be child, siblings or top level.'),
00086       'required context' => new panels_required_context(t('Term'), 'term'),
00087       'category' => array(t('Term context'), -9),
00088     ),
00089   );
00090 }

Here is the call graph for this function:

panels_admin_edit_term_list ( id,
parents,
conf = array() 
)

Returns an edit form for the custom type.

Definition at line 105 of file term_list.inc.

References panels_admin_term_list_options().

00105                                                                      {
00106   // Apply defaults
00107   if (empty($conf)) {
00108     $conf = array('title' => '', 'type' => 'child', 'list_type' => 'ul');
00109   }
00110 
00111   $form['type'] = array(
00112     '#type' => 'radios',
00113     '#title' => t('Which terms'),
00114     '#options' => panels_admin_term_list_options(),
00115     '#default_value' => $conf['type'],
00116     '#prefix' => '<div class="clear-block no-float">',
00117     '#suffix' => '</div>',
00118   );
00119 
00120   $form['list_type'] = array(
00121     '#type' => 'select',
00122     '#title' => t('List type'),
00123     '#options' => array('ul' => t('Unordered'), 'ol' => t('Ordered')),
00124     '#default_value' => $conf['list_type'],
00125   );
00126 
00127   return $form;
00128 }

Here is the call graph for this function:

panels_admin_term_list_options (  ) 

Definition at line 92 of file term_list.inc.

Referenced by panels_admin_edit_term_list(), panels_admin_title_term_list(), and panels_content_term_list().

00092                                           {
00093   return array(
00094     'child' => t('Child terms'),
00095     'related' => t('Related terms'),
00096     'sibling' => t('Sibling terms'),
00097     'top' => t('Top level terms'),
00098     'synonyms' => t('Term synonyms'),
00099   );
00100 }

Here is the caller graph for this function:

panels_admin_title_term_list ( conf,
context 
)

Definition at line 130 of file term_list.inc.

References panels_admin_term_list_options().

00130                                                        {
00131   $options = panels_admin_term_list_options();
00132   return t('"@s" @type', array('@s' => $context->identifier, '@type' => drupal_strtolower($options[$conf['type']])));
00133 }

Here is the call graph for this function:

panels_content_term_list ( conf,
panel_args,
context 
)

Output function for the 'node' content type. Outputs a node based on the module and delta supplied in the configuration.

Definition at line 26 of file term_list.inc.

References panels_admin_term_list_options().

00026                                                                 {
00027   $term = isset($context->data) ? drupal_clone($context->data) : NULL;
00028   $block = new stdClass();
00029   $block->module = 'term-list';
00030 
00031   $options = panels_admin_term_list_options();
00032   if ($term) {
00033     $block->subject = $options[$conf['type']];
00034     $block->delta = $conf['type'];
00035     switch ($conf['type']) {
00036       case 'related':
00037         $terms = taxonomy_get_related($term->tid);
00038         break;
00039 
00040       case 'child':
00041       default:
00042         $terms = taxonomy_get_children($term->tid);
00043         break;
00044 
00045       case 'top':
00046         $terms = taxonomy_get_children(0, $term->vid);
00047         break;
00048 
00049       case 'sibling':
00050         $parent = db_result(db_query("SELECT parent FROM {term_hierarchy} WHERE tid = %d", $term->tid));
00051         $terms = taxonomy_get_children($parent, $term->vid);
00052         // Remove the term that started this.
00053         unset($terms[$term->tid]);
00054         break;
00055 
00056       case 'synonyms':
00057         $terms = taxonomy_get_synonyms($term->tid);
00058         break;
00059     }
00060     if ($terms) {
00061       foreach ($terms as $related) {
00062         $items[$related->tid] = l($related->name, taxonomy_term_path($related), array('rel' => 'tag', 'title' => strip_tags($related->description)));
00063       }
00064 
00065       $block->content = theme('item_list', $items, NULL, $conf['list_type']);
00066     }
00067   }
00068   else {
00069     $block->content = t('Term description goes here.');
00070     $block->delta = 'unknown';
00071   }
00072 
00073   return $block;
00074 }

Here is the call graph for this function:

panels_term_list_panels_content_types (  ) 

Callback function to supply a list of content types.

Definition at line 8 of file term_list.inc.

00008                                                  {
00009   $items['term_list'] = array(
00010     'title' => t('List of related terms'),
00011     'content_types' => 'panels_admin_content_types_term_list',
00012     // only provides a single content type
00013     'single' => TRUE,
00014     'render callback' => 'panels_content_term_list',
00015     'add callback' => 'panels_admin_edit_term_list',
00016     'edit callback' => 'panels_admin_edit_term_list',
00017     'title callback' => 'panels_admin_title_term_list',
00018   );
00019   return $items;
00020 }


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