1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
class PanelizerEntityTaxonomyTerm extends PanelizerEntityDefault {
|
13 |
|
|
public $entity_admin_root = 'admin/structure/taxonomy/%';
|
14 |
|
|
public $entity_admin_bundle = 3;
|
15 |
|
|
public $views_table = 'taxonomy_term_data';
|
16 |
|
|
public $uses_page_manager = TRUE;
|
17 |
|
|
|
18 |
e5e66f93
|
Assos Assos
|
public function init($plugin) {
|
19 |
|
|
if (module_exists('taxonomy_revision')) {
|
20 |
|
|
$this->supports_revisions = TRUE;
|
21 |
|
|
}
|
22 |
|
|
parent::init($plugin);
|
23 |
|
|
}
|
24 |
|
|
|
25 |
85ad3d82
|
Assos Assos
|
public function entity_access($op, $entity) {
|
26 |
|
|
|
27 |
|
|
if ($op == 'update' || $op == 'delete') {
|
28 |
|
|
return taxonomy_term_edit_access($entity);
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
if ($op == 'view') {
|
32 |
|
|
return TRUE;
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
return FALSE;
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
public function entity_save($entity) {
|
42 |
|
|
taxonomy_term_save($entity);
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
public function entity_identifier($entity) {
|
46 |
|
|
return t('This taxonomy term');
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
public function entity_bundle_label() {
|
50 |
|
|
return t('Taxonomy vocabulary');
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
function get_default_display($bundle, $view_mode) {
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
return parent::get_default_display($bundle, $view_mode);
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
public function hook_default_page_manager_handlers(&$handlers) {
|
66 |
|
|
page_manager_get_task('term_view');
|
67 |
|
|
|
68 |
|
|
$handler = new stdClass;
|
69 |
|
|
$handler->disabled = FALSE;
|
70 |
|
|
$handler->api_version = 1;
|
71 |
|
|
$handler->name = 'term_view_panelizer';
|
72 |
|
|
$handler->task = 'term_view';
|
73 |
|
|
$handler->subtask = '';
|
74 |
|
|
$handler->handler = 'panelizer_node';
|
75 |
|
|
$handler->weight = -100;
|
76 |
|
|
$handler->conf = array(
|
77 |
|
|
'title' => t('Term panelizer'),
|
78 |
|
|
'context' => page_manager_term_view_get_type() == 'multiple' ? 'argument_terms_1' : 'argument_term_1',
|
79 |
|
|
'access' => array(),
|
80 |
|
|
);
|
81 |
|
|
$handlers['term_view_panelizer'] = $handler;
|
82 |
|
|
|
83 |
|
|
return $handlers;
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
public function hook_form_alter(&$form, &$form_state, $form_id) {
|
92 |
|
|
if ($form_id == 'taxonomy_form_vocabulary') {
|
93 |
|
|
if (isset($form['#vocabulary'])) {
|
94 |
|
|
$bundle = $form['#vocabulary']->machine_name;
|
95 |
|
|
$this->add_bundle_setting_form($form, $form_state, $bundle, array('machine_name'));
|
96 |
|
|
}
|
97 |
|
|
}
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
public function get_entity_view_entity($build) {
|
107 |
|
|
$element = '#term';
|
108 |
|
|
if (isset($build[$element])) {
|
109 |
|
|
return $build[$element];
|
110 |
|
|
}
|
111 |
|
|
}
|
112 |
|
|
|
113 |
e5e66f93
|
Assos Assos
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
public function get_page_manager_task_name() {
|
120 |
|
|
if (empty($this->plugin['uses page manager'])) {
|
121 |
|
|
return FALSE;
|
122 |
|
|
}
|
123 |
|
|
else {
|
124 |
|
|
return 'term_view';
|
125 |
|
|
}
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
public function is_page_manager_enabled() {
|
135 |
|
|
return variable_get('page_manager_term_view_disabled', TRUE);
|
136 |
|
|
}
|
137 |
|
|
|
138 |
85ad3d82
|
Assos Assos
|
} |