Révision c304a780
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/term_view.inc | ||
---|---|---|
16 | 16 |
function page_manager_term_view_page_manager_tasks() { |
17 | 17 |
if (module_exists('taxonomy')) { |
18 | 18 |
return array( |
19 |
// This is a 'page' task and will fall under the page admin UI |
|
19 |
// This is a 'page' task and will fall under the page admin UI.
|
|
20 | 20 |
'task type' => 'page', |
21 | 21 |
|
22 | 22 |
'title' => t('Taxonomy term template'), |
... | ... | |
29 | 29 |
'hook menu' => 'page_manager_term_view_menu', |
30 | 30 |
'hook menu alter' => 'page_manager_term_view_menu_alter', |
31 | 31 |
|
32 |
// Provide a setting to the primary settings UI for Panels |
|
32 |
// Provide a setting to the primary settings UI for Panels.
|
|
33 | 33 |
'admin settings' => 'page_manager_term_view_admin_settings', |
34 | 34 |
// Even though we don't have subtasks, this allows us to save our settings. |
35 | 35 |
'save subtask callback' => 'page_manager_term_view_save', |
... | ... | |
48 | 48 |
'enable callback' => 'page_manager_term_view_enable', |
49 | 49 |
'access callback' => 'page_manager_term_view_access_check', |
50 | 50 |
|
51 |
// Allow additional operations |
|
51 |
// Allow additional operations.
|
|
52 | 52 |
'operations' => array( |
53 | 53 |
'settings' => array( |
54 | 54 |
'title' => t('Settings'), |
... | ... | |
79 | 79 |
$items['taxonomy/term/%taxonomy_term']['file'] = $task['file']; |
80 | 80 |
} |
81 | 81 |
else { |
82 |
// automatically disable this task if it cannot be enabled.
|
|
82 |
// Automatically disable this task if it cannot be enabled.
|
|
83 | 83 |
variable_set('page_manager_term_view_disabled', TRUE); |
84 | 84 |
|
85 | 85 |
if (isset($items['taxonomy/term/%taxonomy_term']['page callback'])) { |
... | ... | |
87 | 87 |
} |
88 | 88 |
// Because Views changes %taxonomy_term to %views_arg, check to see if that |
89 | 89 |
// is why we can't enable: |
90 |
else if (isset($items['taxonomy/term/%views_arg']['page callback'])) {
|
|
90 |
elseif (isset($items['taxonomy/term/%views_arg']['page callback'])) { |
|
91 | 91 |
$callback = $items['taxonomy/term/%views_arg']['page callback']; |
92 | 92 |
} |
93 | 93 |
else { |
... | ... | |
112 | 112 |
// potentially load nodes that were not necessary, execute some of the code |
113 | 113 |
// prior to identifying the correct CTools or Page Manager task handler and |
114 | 114 |
// only proceed with the rest of the code if necessary. |
115 |
|
|
116 | 115 |
// Assign the term name as the page title. |
117 | 116 |
drupal_set_title($term->name); |
118 | 117 |
|
... | ... | |
126 | 125 |
// Set the non-aliased path as a default shortlink. |
127 | 126 |
drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE); |
128 | 127 |
|
129 |
// Trigger the main |
|
128 |
// Trigger the main.
|
|
130 | 129 |
$build = taxonomy_term_show($term); |
131 | 130 |
|
132 |
// Load my task plugin |
|
131 |
// Load my task plugin.
|
|
133 | 132 |
$task = page_manager_get_task('term_view'); |
134 | 133 |
|
135 | 134 |
// Load the term into a context. |
... | ... | |
157 | 156 |
|
158 | 157 |
// Otherwise, fall back to replicating the output normally generated by |
159 | 158 |
// taxonomy_term_page(). |
160 |
|
|
161 | 159 |
// Build breadcrumb based on the hierarchy of the term. |
162 | 160 |
$current = (object) array( |
163 | 161 |
'tid' => $term->tid, |
... | ... | |
296 | 294 |
} |
297 | 295 |
|
298 | 296 |
function page_manager_term_view_get_type() { |
299 |
// $view_type = variable_get('page_manager_term_view_type', 'multiple'); |
|
300 | 297 |
// Revert to just allowing single. |
301 | 298 |
$view_type = 'single'; |
302 | 299 |
|
... | ... | |
369 | 366 |
* The subtask id |
370 | 367 |
* @param $contexts |
371 | 368 |
* The contexts loaded for the task. |
372 |
* @return |
|
369 |
* |
|
370 |
* @return bool |
|
373 | 371 |
* TRUE if the current user can access the page. |
374 | 372 |
*/ |
375 | 373 |
function page_manager_term_view_access_check($task, $subtask_id, $contexts) { |
Formats disponibles : Unified diff
Weekly update of contrib modules