PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.9.2.7
Advanced Custom Fields: Extended v0.9.2.7
0.9.2.7 0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / screens / screen-taxonomy.php
acf-extended / includes / screens Last commit date
screen-attachment.php 7 months ago screen-options-page.php 7 months ago screen-post.php 7 months ago screen-settings.php 7 months ago screen-taxonomy.php 3 months ago screen-user.php 7 months ago
screen-taxonomy.php
260 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_screen_taxonomy')):
8
9 class acfe_screen_taxonomy{
10
11 // vars
12 var $taxonomy;
13
14 /**
15 * construct
16 */
17 function __construct(){
18
19 /**
20 * hooks:
21 *
22 * acfe/load_term $taxonomy, $term_id
23 * acfe/add_term_meta_boxes $taxonomy, $term
24 *
25 * acfe/load_terms $taxonomy
26 * acfe/add_terms_meta_boxes $taxonomy
27 */
28
29 // edit
30 add_action('load-term.php', array($this, 'term_load'));
31
32 // list
33 add_action('load-edit-tags.php', array($this, 'terms_load'));
34
35 // location screen
36 add_filter('acf/location/screen', array($this, 'location_screen'));
37
38 }
39
40
41 /**
42 * term_load
43 *
44 * load-term.php
45 */
46 function term_load(){
47
48 // global
49 global $taxnow;
50
51 // vars
52 $taxonomy = $taxnow;
53 $term_id = acfe_get_post_id('id');
54
55 // set vars
56 $this->taxonomy = $taxonomy;
57
58 // actions
59 do_action("acfe/load_term", $taxonomy, $term_id);
60 do_action("acfe/load_term/taxonomy={$taxonomy}", $taxonomy, $term_id);
61
62 // hooks
63 add_action("{$taxonomy}_term_edit_form_top", array($this, 'add_term_meta_boxes'), 10, 2);
64 add_action("{$taxonomy}_edit_form", array($this, 'do_term_meta_boxes'), 10, 2);
65
66 }
67
68
69 /**
70 * add_term_meta_boxes
71 *
72 * {$taxonomy}_term_edit_form_top
73 *
74 * @param $term
75 * @param $taxonomy
76 */
77 function add_term_meta_boxes($term, $taxonomy){
78
79 do_action("acfe/add_term_meta_boxes", $taxonomy, $term);
80 do_action("acfe/add_term_meta_boxes/taxonomy={$taxonomy}", $taxonomy, $term);
81
82 // enhanced ui
83 if(acf_get_setting('acfe/modules/ui')){
84
85 do_meta_boxes(get_current_screen(), 'acf_after_title', $term);
86
87 }
88
89 }
90
91
92 /**
93 * do_term_meta_boxes
94 *
95 * {$taxonomy}_edit_form
96 *
97 * @param $term
98 * @param $taxonomy
99 */
100 function do_term_meta_boxes($term, $taxonomy){
101
102 // enhanced ui
103 if(acf_get_setting('acfe/modules/ui')){
104
105 // get screen
106 $screen = get_current_screen();
107
108 // do metaboxes
109 do_meta_boxes($screen, 'normal', $term);
110 do_meta_boxes($screen, 'side', $term);
111
112 }
113
114 }
115
116
117 /**
118 * terms_load
119 *
120 * load-edit-tags.php
121 */
122 function terms_load(){
123
124 // global
125 global $pagenow, $taxnow;
126
127 // validate (wordpress also load this hook on term.php)
128 if($pagenow !== 'edit-tags.php'){
129 return;
130 }
131
132 // vars
133 $taxonomy = $taxnow;
134
135 // set vars
136 $this->taxonomy = $taxonomy;
137
138 // actions
139 do_action("acfe/load_terms", $taxonomy);
140 do_action("acfe/load_terms/taxonomy={$taxonomy}", $taxonomy);
141
142 // hooks
143 add_action('admin_footer', array($this, 'terms_footer'));
144
145 }
146
147
148 /**
149 * terms_footer
150 *
151 * admin_footer
152 */
153 function terms_footer(){
154
155 do_action('acfe/add_terms_meta_boxes', $this->taxonomy);
156
157 $this->terms_do_meta_boxes();
158
159 }
160
161
162 /**
163 * terms_do_meta_boxes
164 */
165 function terms_do_meta_boxes(){
166
167 // check filter
168 if(!acf_is_filter_enabled('acfe/taxonomy_list')){
169 return;
170 }
171
172 ?>
173 <template id="tmpl-acf-after-title">
174
175 <div id="poststuff" class="acfe-list-postboxes">
176 <form method="post">
177 <?php do_meta_boxes('edit', 'acf_after_title', $this->taxonomy); ?>
178 </form>
179 </div>
180
181 </template>
182
183 <template id="tmpl-acf-normal">
184
185 <div id="poststuff" class="acfe-list-postboxes">
186 <form method="post">
187 <?php do_meta_boxes('edit', 'normal', $this->taxonomy); ?>
188 </form>
189 </div>
190
191 </template>
192
193 <template id="tmpl-acf-side">
194
195 <div class="acf-column-2">
196
197 <div id="poststuff" class="acfe-list-postboxes -side">
198 <form method="post">
199 <?php do_meta_boxes('edit', 'side', $this->taxonomy); ?>
200 </form>
201 </div>
202
203 </div>
204
205 </template>
206 <script type="text/javascript">
207 (function($){
208
209 // main form
210 var $main = $('#posts-filter');
211
212 $main.wrap('<div class="acf-columns-2" />');
213 $main.wrap('<div class="acf-column-1" />');
214
215 // field groups
216 var $column_1 = $('.acf-column-1');
217
218 $column_1.prepend($('.search-form'));
219 $column_1.prepend($('#tmpl-acf-after-title').html());
220 $column_1.append($('#tmpl-acf-normal').html());
221 $column_1.after($('#tmpl-acf-side').html());
222
223 <?php if(!acf_get_setting('acfe/modules/ui') || !acf_is_filter_enabled('acfe/taxonomy_list/side')): ?>
224 $('.acf-columns-2').removeClass('acf-columns-2');
225 <?php endif; ?>
226
227 })(jQuery);
228 </script>
229 <?php
230 }
231
232
233 /**
234 * location_screen
235 *
236 * acf/location/screen
237 *
238 * @param $screen
239 *
240 * @return mixed
241 */
242 function location_screen($screen){
243
244 // add taxonomy term id and check term_id doesn't exist
245 if(acfe_get($screen, 'taxonomy') && !acfe_get($screen, 'term_id')){
246
247 global $tag;
248 $screen['term_id'] = acfe_get($tag, 'term_id');
249
250 }
251
252 return $screen;
253
254 }
255
256 }
257
258 acf_new_instance('acfe_screen_taxonomy');
259
260 endif;