1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Plugins are described by creating a $plugin array which will be used
|
5
|
* by the system that includes this file.
|
6
|
*/
|
7
|
$plugin = array(
|
8
|
'single' => TRUE,
|
9
|
'title' => t('Term description'),
|
10
|
'icon' => 'icon_term.png',
|
11
|
'description' => t('Term description.'),
|
12
|
'required context' => new ctools_context_required(t('Term'), array('term', 'taxonomy_term')),
|
13
|
'category' => t('Taxonomy term'),
|
14
|
);
|
15
|
|
16
|
function ctools_term_description_content_type_render($subtype, $conf, $panel_args, $context) {
|
17
|
$term = isset($context->data) ? clone($context->data) : NULL;
|
18
|
$block = new stdClass();
|
19
|
$block->module = 'node_type';
|
20
|
|
21
|
if (!empty($term)) {
|
22
|
$block->title = $term->name;
|
23
|
$block->content = check_markup($term->description, $term->format, '', TRUE);
|
24
|
$block->delta = $term->tid;
|
25
|
|
26
|
if (user_access('administer taxonomy')) {
|
27
|
$block->admin_links['update'] = array(
|
28
|
'title' => t('Edit term'),
|
29
|
'alt' => t("Edit this term"),
|
30
|
'href' => "taxonomy/term/$term->tid/edit",
|
31
|
'query' => drupal_get_destination(),
|
32
|
);
|
33
|
}
|
34
|
}
|
35
|
else {
|
36
|
$block->title = '';
|
37
|
$block->content = t('Term description goes here.');
|
38
|
$block->delta = 'unknown';
|
39
|
}
|
40
|
|
41
|
return $block;
|
42
|
}
|
43
|
|
44
|
function ctools_term_description_content_type_admin_title($subtype, $conf, $context) {
|
45
|
return t('"@s" term description', array('@s' => $context->identifier));
|
46
|
}
|
47
|
|
48
|
function ctools_term_description_content_type_edit_form($form, &$form_state) {
|
49
|
// provide a blank form so we have a place to have context setting.
|
50
|
return $form;
|
51
|
}
|