term_description.inc

Go to the documentation of this file.
00001 <?php
00002 // $Id: term_description.inc,v 1.1.2.10 2008/07/09 21:00:10 merlinofchaos Exp $
00003 
00004 
00005 /**
00006  * Callback function to supply a list of content types.
00007  */
00008 function panels_term_description_panels_content_types() {
00009   $items['term_description'] = array(
00010     'title' => t('Term description'),
00011     'content_types' => 'panels_admin_content_types_term_description',
00012     // only provides a single content type
00013     'single' => TRUE,
00014     'render callback' => 'panels_content_term_description',
00015     'add callback' => 'panels_admin_edit_term_description',
00016     'edit callback' => 'panels_admin_edit_term_description',
00017     'title callback' => 'panels_admin_title_term_description',
00018   );
00019   return $items;
00020 }
00021 
00022 /**
00023  * Output function for the 'node' content type. Outputs a node
00024  * based on the module and delta supplied in the configuration.
00025  */
00026 function panels_content_term_description($conf, $panel_args, $context) {
00027   $term = isset($context->data) ? drupal_clone($context->data) : NULL;
00028   $block = new stdClass();
00029   $block->module = 'node_type';
00030 
00031   $block->subject = $term->name;
00032   if ($term) {
00033     $block->content = _filter_autop(filter_xss_admin($term->description));
00034     $block->delta = $term->tid;
00035 
00036     if (user_access('administer taxonomy')) {
00037       $block->admin_links['update'] = array(
00038         'title' => t('Edit term'),
00039         'alt' => t("Edit this term"),
00040         'href' => "admin/content/taxonomy/edit/term/$term->tid",
00041         'query' => drupal_get_destination(),
00042       );
00043     }
00044   }
00045   else {
00046     $block->content = t('Term description goes here.');
00047     $block->delta = 'unknown';
00048   }
00049 
00050   return $block;
00051 }
00052 
00053 /**
00054  * Return all content types available.
00055  */
00056 function panels_admin_content_types_term_description() {
00057   return array(
00058     'description' => array(
00059       'title' => t('Term description'),
00060       'icon' => 'icon_node.png',
00061       'path' => panels_get_path('content_types/node'),
00062       'description' => t('Term description.'),
00063       'required context' => new panels_required_context(t('Term'), 'term'),
00064       'category' => array(t('Term context'), -9),
00065     ),
00066   );
00067 }
00068 
00069 function panels_admin_title_term_description($conf, $context) {
00070   return t('"@s" term description', array('@s' => $context->identifier));
00071 }
00072 

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