You are here

function ctools_term_description_content_type_render in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 plugins/content_types/term_context/term_description.inc \ctools_term_description_content_type_render()

File

plugins/content_types/term_context/term_description.inc, line 18

Code

function ctools_term_description_content_type_render($subtype, $conf, $panel_args, $context) {
  $term = isset($context->data) ? clone $context->data : NULL;
  $block = new stdClass();
  $block->module = 'node_type';
  if (!empty($term)) {
    $block->title = $term->name;
    $block->content = check_markup($term->description, $term->format, '', TRUE);
    $block->delta = $term->tid;
    if (user_access('administer taxonomy')) {
      $block->admin_links['update'] = array(
        'title' => t('Edit term'),
        'alt' => t("Edit this term"),
        'href' => "taxonomy/term/{$term->tid}/edit",
        'query' => drupal_get_destination(),
      );
    }
  }
  else {
    $block->title = '';
    $block->content = t('Term description goes here.');
    $block->delta = 'unknown';
  }
  return $block;
}