Révision e4c061ad
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/ctools/plugins/content_types/term_context/term_list.inc | ||
---|---|---|
11 | 11 |
'description' => t('Terms related to an existing term; may be child, siblings or top level.'), |
12 | 12 |
'required context' => new ctools_context_required(t('Term'), array('term', 'taxonomy_term')), |
13 | 13 |
'category' => t('Taxonomy term'), |
14 |
'defaults' => array('title' => '', 'type' => 'child', 'list_type' => 'ul', 'path' => 'taxonomy/term'), |
|
14 |
'defaults' => array( |
|
15 |
'title' => '', |
|
16 |
'type' => 'child', |
|
17 |
'include_current_term' => FALSE, |
|
18 |
'list_type' => 'ul', |
|
19 |
'path' => 'taxonomy/term', |
|
20 |
), |
|
15 | 21 |
); |
16 | 22 |
|
17 | 23 |
function ctools_term_list_content_type_render($subtype, $conf, $panel_args, $context) { |
... | ... | |
40 | 46 |
|
41 | 47 |
case 'child': |
42 | 48 |
default: |
49 |
if (!empty($conf['include_current_term'])) { |
|
50 |
$terms[] = $term; |
|
51 |
} |
|
43 | 52 |
$terms = taxonomy_get_children($term->tid); |
44 | 53 |
break; |
45 | 54 |
|
... | ... | |
49 | 58 |
|
50 | 59 |
case 'parent': |
51 | 60 |
$terms = taxonomy_get_parents($term->tid); |
61 |
if (!empty($conf['include_current_term'])) { |
|
62 |
$terms[] = $term; |
|
63 |
} |
|
52 | 64 |
$block->title = count($terms) == 1 ? t('Parent term') : t('Parent terms'); |
53 | 65 |
break; |
54 | 66 |
|
... | ... | |
116 | 128 |
'#suffix' => '</div>', |
117 | 129 |
); |
118 | 130 |
|
131 |
$form['include_current_term'] = array( |
|
132 |
'#type' => 'checkbox', |
|
133 |
'#title' => t('Include the current term in the list'), |
|
134 |
'#default_value' => !empty($conf['include_current_term']), |
|
135 |
'#prefix' => '<div class="clearfix no-float">', |
|
136 |
'#suffix' => '</div>', |
|
137 |
'#states' => array( |
|
138 |
'invisible' => array( |
|
139 |
':input[name="type"], unique1' => array('!value' => 'child'), |
|
140 |
':input[name="type"], unique2' => array('!value' => 'parent'), |
|
141 |
), |
|
142 |
), |
|
143 |
); |
|
144 |
|
|
119 | 145 |
$form['list_type'] = array( |
120 | 146 |
'#type' => 'select', |
121 | 147 |
'#title' => t('List type'), |
Formats disponibles : Unified diff
Weekly update of contrib modules