PluginProbe
Advanced Custom Fields: Extended / 0.8.7.5
Advanced Custom Fields: Extended v0.8.7.5
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 All 92 releases
acf-extended / includes / modules / dynamic-taxonomy.php
dynamic-taxonomy.php
2,185 lines 71.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if(!defined('ABSPATH'))
4 exit;
5
6 // Check setting
7 if(!acf_get_setting('acfe/modules/dynamic_taxonomies'))
8 return;
9
10 /**
11 * Register Dynamic Taxonomy
12 */
13 add_action('init', 'acfe_dt_register');
14 function acfe_dt_register(){
15
16 register_post_type('acfe-dt', array(
17 'label' => 'Taxonomies',
18 'description' => 'Taxonomies',
19 'labels' => array(
20 'name' => 'Taxonomies',
21 'singular_name' => 'Taxonomy',
22 'menu_name' => 'Taxonomies',
23 'edit_item' => 'Edit Taxonomy',
24 'add_new_item' => 'New Taxonomy',
25 ),
26 'supports' => array('title'),
27 'hierarchical' => false,
28 'public' => false,
29 'show_ui' => true,
30 'show_in_menu' => 'tools.php',
31 'menu_icon' => 'dashicons-layout',
32 'show_in_admin_bar' => false,
33 'show_in_nav_menus' => false,
34 'can_export' => false,
35 'has_archive' => false,
36 'rewrite' => false,
37 'exclude_from_search' => true,
38 'publicly_queryable' => false,
39 'capabilities' => array(
40 'publish_posts' => acf_get_setting('capability'),
41 'edit_posts' => acf_get_setting('capability'),
42 'edit_others_posts' => acf_get_setting('capability'),
43 'delete_posts' => acf_get_setting('capability'),
44 'delete_others_posts' => acf_get_setting('capability'),
45 'read_private_posts' => acf_get_setting('capability'),
46 'edit_post' => acf_get_setting('capability'),
47 'delete_post' => acf_get_setting('capability'),
48 'read_post' => acf_get_setting('capability'),
49 ),
50 'acfe_admin_orderby' => 'title',
51 'acfe_admin_order' => 'ASC',
52 'acfe_admin_ppp' => 999,
53 ));
54
55 }
56
57 add_action('current_screen', 'acfe_dt_current_screen');
58 function acfe_dt_current_screen(){
59
60 if(!acf_is_screen('acfe-dt'))
61 return;
62
63 // Flush Permalinks
64 flush_rewrite_rules();
65
66 }
67
68 /**
69 * WP Register Taxonomies
70 */
71 add_action('init', 'acfe_dt_registers');
72 function acfe_dt_registers(){
73
74 $dynamic_taxonomies = acfe_settings('modules.dynamic_taxonomy.data');
75
76 if(empty($dynamic_taxonomies))
77 return;
78
79 foreach($dynamic_taxonomies as $name => $args){
80
81 if(taxonomy_exists($name))
82 continue;
83
84 // Extract 'post_types' from 'register_args'
85 $post_types = acf_extract_var($args, 'post_types', array());
86
87 // Textdomain
88 $textdomain = 'ACF Extended: Taxonomies';
89
90 // Label
91 if(isset($args['label'])){
92
93 acfe__($args['label'], 'Label', $textdomain);
94
95 }
96
97 // Description
98 if(isset($args['description'])){
99
100 acfe__($args['description'], 'Description', $textdomain);
101
102 }
103
104 // Labels
105 if(isset($args['labels'])){
106
107 foreach($args['labels'] as $label_name => &$label_text){
108
109 acfe__($label_text, ucfirst($label_name), $textdomain);
110
111 }
112
113 }
114
115 // Register: Execute
116 if(!empty($name)){
117
118 register_taxonomy($name, $post_types, $args);
119
120 // Filter Admin: Posts Per Page
121 add_filter('edit_' . $name . '_per_page', 'acfe_dt_filter_admin_ppp');
122
123 }
124
125 }
126
127 }
128
129 /**
130 * ACF Exclude Dynamic Taxonomy from available post types
131 */
132 add_filter('acf/get_post_types', 'acfe_dt_exclude', 10, 2);
133 function acfe_dt_exclude($post_types, $args){
134
135 if(empty($post_types))
136 return $post_types;
137
138 foreach($post_types as $k => $post_type){
139
140 if($post_type !== 'acfe-dt')
141 continue;
142
143 unset($post_types[$k]);
144
145 }
146
147 return $post_types;
148
149 }
150
151 add_action('post_submitbox_misc_actions', 'acfe_dt_misc_actions');
152 function acfe_dt_misc_actions($post){
153
154 if($post->post_type !== 'acfe-dt')
155 return;
156
157 $name = get_field('acfe_dt_name', $post->ID);
158
159 ?>
160 <div class="misc-pub-section misc-pub-acfe-field-group-export" style="padding-top:2px;">
161 <span style="font-size:17px;color: #82878c;line-height: 1.3;width: 20px;margin-right: 2px;" class="dashicons dashicons-editor-code"></span> Export: <a href="<?php echo admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dt_export&action=php&keys=' . $name); ?>">PHP</a> <a href="<?php echo admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dt_export&action=json&keys=' . $name); ?>">Json</a>
162 </div>
163 <?php
164
165 }
166
167 /**
168 * Dynamic Taxonomy Save
169 */
170 add_action('acf/save_post', 'acfe_dt_filter_save', 20);
171 function acfe_dt_filter_save($post_id){
172
173 if(get_post_type($post_id) !== 'acfe-dt')
174 return;
175
176 // Register Args
177 $label = get_post_field('post_title', $post_id);
178 $name = get_field('acfe_dt_name', $post_id);
179 $description = get_field('description', $post_id);
180 $hierarchical = get_field('hierarchical', $post_id);
181 $post_types = get_field('post_types', $post_id);
182 $public = get_field('public', $post_id);
183 $publicly_queryable = get_field('publicly_queryable', $post_id);
184 $update_count_callback = get_field('update_count_callback', $post_id);
185 $sort = get_field('sort', $post_id);
186
187 // Labels
188 $labels = get_field('labels', $post_id);
189 $labels_args = array();
190 foreach($labels as $k => $l){
191 if(empty($l))
192 continue;
193
194 $labels_args[$k] = $l;
195 }
196
197 // Menu
198 $show_ui = get_field('show_ui', $post_id);
199 $show_in_menu = get_field('show_in_menu', $post_id);
200 $show_in_nav_menus = get_field('show_in_nav_menus', $post_id);
201 $show_tagcloud = get_field('show_tagcloud', $post_id);
202 $meta_box_cb = get_field('meta_box_cb', $post_id);
203 $meta_box_cb_custom = get_field('meta_box_cb_custom', $post_id);
204 $show_in_quick_edit = get_field('show_in_quick_edit', $post_id);
205 $show_admin_column = get_field('show_admin_column', $post_id);
206
207 // Capability
208 $capabilities = acf_decode_choices(get_field('capabilities', $post_id));
209
210 // Single
211 $single_template = get_field('acfe_dt_single_template', $post_id);
212 $single_posts_per_page = (int) get_field('acfe_dt_single_posts_per_page', $post_id);
213 $single_orderby = get_field('acfe_dt_single_orderby', $post_id);
214 $single_order = get_field('acfe_dt_single_order', $post_id);
215 $rewrite = get_field('rewrite', $post_id);
216 $rewrite_args_select = get_field('rewrite_args_select', $post_id);
217 $rewrite_args = get_field('rewrite_args', $post_id);
218
219 // Admin
220 $admin_posts_per_page = (int) get_field('acfe_dt_admin_terms_per_page', $post_id);
221 $admin_orderby = get_field('acfe_dt_admin_orderby', $post_id);
222 $admin_order = get_field('acfe_dt_admin_order', $post_id);
223
224 // REST
225 $show_in_rest = get_field('show_in_rest', $post_id);
226 $rest_base = get_field('rest_base', $post_id);
227 $rest_controller_class = get_field('rest_controller_class', $post_id);
228
229 // Register: Args
230 $register_args = array(
231 'label' => $label,
232 'description' => $description,
233 'hierarchical' => $hierarchical,
234 'post_types' => $post_types,
235 'public' => $public,
236 'publicly_queryable' => $publicly_queryable,
237 'update_count_callback' => $update_count_callback,
238 'sort' => $sort,
239
240 // Labels
241 'labels' => $labels_args,
242
243 // Menu
244 'show_ui' => $show_ui,
245 'show_in_menu' => $show_in_menu,
246 'show_in_nav_menus' => $show_in_nav_menus,
247 'show_tagcloud' => $show_tagcloud,
248 'show_in_quick_edit' => $show_in_quick_edit,
249 'show_admin_column' => $show_admin_column,
250
251 // Single
252 'rewrite' => $rewrite,
253
254 // REST
255 'show_in_rest' => $show_in_rest,
256 'rest_base' => $rest_base,
257 'rest_controller_class' => $rest_controller_class,
258
259 // ACFE: Single
260 'acfe_single_template' => $single_template,
261 'acfe_single_ppp' => $single_posts_per_page,
262 'acfe_single_orderby' => $single_orderby,
263 'acfe_single_order' => $single_order,
264
265 // ACFE: Admin
266 'acfe_admin_ppp' => $admin_posts_per_page,
267 'acfe_admin_orderby' => $admin_orderby,
268 'acfe_admin_order' => $admin_order,
269 );
270
271 // Rewrite: override
272 if($rewrite && $rewrite_args_select){
273
274 $register_args['rewrite'] = array(
275 'slug' => $rewrite_args['acfe_dt_rewrite_slug'],
276 'with_front' => $rewrite_args['acfe_dt_rewrite_with_front'],
277 'hierarchical' => $rewrite_args['hierarchical']
278 );
279
280 }
281
282 // Capabilities
283 $register_args['capabilities'] = $capabilities;
284
285 // Metabox CB
286 $register_args['meta_box_cb'] = null;
287
288 if($meta_box_cb === 'false')
289 $register_args['meta_box_cb'] = false;
290
291 elseif($meta_box_cb === 'custom')
292 $register_args['meta_box_cb'] = $meta_box_cb_custom;
293
294 // Get ACFE option
295 $option = acfe_settings('modules.dynamic_taxonomy.data');
296
297 // Create ACFE option
298 $option[$name] = $register_args;
299
300 // Sort keys ASC
301 ksort($option);
302
303 // Update ACFE option
304 acfe_settings('modules.dynamic_taxonomy.data', $option, true);
305
306 // Update post
307 wp_update_post(array(
308 'ID' => $post_id,
309 'post_name' => $name,
310 ));
311
312 }
313
314 /**
315 * Dynamic Taxonomy Status Publish > Trash
316 */
317 add_action('publish_to_trash', 'acfe_dt_filter_status_trash');
318 function acfe_dt_filter_status_trash($post){
319
320 if(get_post_type($post->ID) !== 'acfe-dt')
321 return;
322
323 $post_id = $post->ID;
324 $name = get_field('acfe_dt_name', $post_id);
325
326 // Get ACFE option
327 $option = acfe_settings('modules.dynamic_taxonomy.data');
328
329 // Check ACFE option
330 if(isset($option[$name]))
331 unset($option[$name]);
332
333 // Update ACFE option
334 acfe_settings('modules.dynamic_taxonomy.data', $option, true);
335
336 // Flush permalinks
337 flush_rewrite_rules();
338
339 }
340
341 /**
342 * Dynamic Taxonomy Status Trash > Publish
343 */
344 add_action('trash_to_publish', 'acfe_dt_filter_status_publish');
345 function acfe_dt_filter_status_publish($post){
346
347 if(get_post_type($post->ID) !== 'acfe-dt')
348 return;
349
350 acfe_dt_filter_save($post->ID);
351
352 }
353
354 /**
355 * Filter Admin: List
356 */
357 add_filter('get_terms_args', 'acfe_dt_filter_admin_list', 10, 2);
358 function acfe_dt_filter_admin_list($args, $taxonomies){
359
360 if(!is_admin())
361 return $args;
362
363 global $pagenow;
364 if($pagenow !== 'edit-tags.php')
365 return $args;
366
367 if(empty($taxonomies))
368 return $args;
369
370 $taxonomy = array_shift($taxonomies);
371 $taxonomy_obj = get_taxonomy($taxonomy);
372
373 $acfe_admin_orderby = (isset($taxonomy_obj->acfe_admin_orderby) && !empty($taxonomy_obj->acfe_admin_orderby));
374 $acfe_admin_order = (isset($taxonomy_obj->acfe_admin_order) && !empty($taxonomy_obj->acfe_admin_order));
375
376 if($acfe_admin_orderby && (!isset($_REQUEST['orderby']) || empty($_REQUEST['orderby'])))
377 $args['orderby'] = $taxonomy_obj->acfe_admin_orderby;
378
379 if($acfe_admin_order && (!isset($_REQUEST['order']) || empty($_REQUEST['order'])))
380 $args['order'] = $taxonomy_obj->acfe_admin_order;
381
382 return $args;
383
384 }
385
386 /**
387 * Filter Admin: Posts Per Page
388 */
389 function acfe_dt_filter_admin_ppp($ppp){
390
391 global $pagenow;
392 if($pagenow !== 'edit-tags.php')
393 return $ppp;
394
395 $taxonomy = $_GET['taxonomy'];
396 if(empty($taxonomy))
397 return $ppp;
398
399 $taxonomy_obj = get_taxonomy($taxonomy);
400 if(!isset($taxonomy_obj->acfe_admin_ppp) || empty($taxonomy_obj->acfe_admin_ppp))
401 return $ppp;
402
403 // Check if user has a screen option
404 if(!empty(get_user_option('edit_' . $taxonomy . '_per_page')))
405 return $ppp;
406
407 return $taxonomy_obj->acfe_admin_ppp;
408
409 }
410
411 /**
412 * Filter Front: List + Posts Per Page
413 */
414 add_action('pre_get_posts', 'acfe_dt_filter_front_list');
415 function acfe_dt_filter_front_list($query){
416
417 if(is_admin() || !$query->is_main_query() || !is_tax())
418 return;
419
420 $term_obj = $query->get_queried_object();
421
422 if(!is_a($term_obj, 'WP_Term'))
423 return;
424
425 $taxonomy = $term_obj->taxonomy;
426 $taxonomy_obj = get_taxonomy($taxonomy);
427
428 $acfe_single_ppp = (isset($taxonomy_obj->acfe_single_ppp) && !empty($taxonomy_obj->acfe_single_ppp));
429 $acfe_single_orderby = (isset($taxonomy_obj->acfe_single_orderby) && !empty($taxonomy_obj->acfe_single_orderby));
430 $acfe_single_order = (isset($taxonomy_obj->acfe_single_order) && !empty($taxonomy_obj->acfe_single_order));
431
432 if($acfe_single_ppp)
433 $query->set('posts_per_page', $taxonomy_obj->acfe_single_ppp);
434
435 if($acfe_single_orderby)
436 $query->set('orderby', $taxonomy_obj->acfe_single_orderby);
437
438 if($acfe_single_order)
439 $query->set('order', $taxonomy_obj->acfe_single_order);
440
441 }
442
443 /**
444 * Filter Front: Template
445 */
446 add_filter('template_include', 'acfe_dt_filter_template', 999);
447 function acfe_dt_filter_template($template){
448
449 if(!is_tax() && !is_category() && !is_tag())
450 return $template;
451
452 if(!isset(get_queried_object()->taxonomy))
453 return $template;
454
455 $taxonomy_obj = get_queried_object()->taxonomy;
456
457 foreach(get_taxonomies(array('public' => true), 'objects') as $taxonomy){
458 if($taxonomy_obj !== $taxonomy->name || !isset($taxonomy->acfe_single_template))
459 continue;
460
461 if($locate = locate_template(array($taxonomy->acfe_single_template)))
462 return $locate;
463 }
464
465 return $template;
466
467 }
468
469 /**
470 * Admin List Columns
471 */
472 add_filter('manage_edit-acfe-dt_columns', 'acfe_dt_admin_columns');
473 function acfe_dt_admin_columns($columns){
474
475 if(isset($columns['date']))
476 unset($columns['date']);
477
478 $columns['acfe-name'] = __('Name');
479 $columns['acfe-post-types'] = __('Post Types');
480 $columns['acfe-terms'] = __('Terms');
481
482 return $columns;
483
484 }
485
486 /**
487 * Admin List Columns HTML
488 */
489 add_action('manage_acfe-dt_posts_custom_column', 'acfe_dt_admin_columns_html', 10, 2);
490 function acfe_dt_admin_columns_html($column, $post_id){
491
492 // Name
493 if($column === 'acfe-name'){
494
495 echo '<code style="font-size: 12px;">' . get_field('acfe_dt_name', $post_id) . '</code>';
496
497 }
498
499 // Post Types
500 elseif($column === 'acfe-post-types'){
501
502 $post_types = get_field('post_types', $post_id);
503
504 if(empty($post_types)){
505
506 echo '—';
507 return;
508
509 }
510
511 $post_types_names = array();
512 foreach($post_types as $post_type_slug){
513
514 $post_type_obj = get_post_type_object($post_type_slug);
515 if(empty($post_type_obj))
516 continue;
517
518 $post_types_names[] = $post_type_obj->label;
519
520 }
521
522 if(empty($post_types_names)){
523
524 echo '—';
525 return;
526
527 }
528
529 echo implode(', ', $post_types_names);
530
531 }
532
533 // Terms
534 elseif($column === 'acfe-terms'){
535
536 // Name
537 $name = get_field('acfe_dt_name', $post_id);
538
539 // Count
540 $count = wp_count_terms($name, array(
541 'hide_empty' => false
542 ));
543
544 if(is_wp_error($count)){
545
546 echo '—';
547 return;
548
549 }
550
551 echo '<a href="' . admin_url('edit-tags.php?taxonomy=' . $name) . '">' . $count . '</a>';
552
553 }
554
555 }
556
557 /**
558 * Admin List Row Actions
559 */
560 add_filter('post_row_actions','acfe_dt_admin_row', 10, 2);
561 function acfe_dt_admin_row($actions, $post){
562
563 if($post->post_type !== 'acfe-dt' || $post->post_status !== 'publish')
564 return $actions;
565
566 $post_id = $post->ID;
567 $name = get_field('acfe_dt_name', $post_id);
568
569 $actions['acfe_dt_export_php'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dt_export&action=php&keys=' . $name) . '">' . __('PHP') . '</a>';
570 $actions['acfe_dt_export_json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dt_export&action=json&keys=' . $name) . '">' . __('Json') . '</a>';
571
572 return $actions;
573
574 }
575
576 /**
577 * Admin Add Config Button
578 */
579 add_action('admin_footer-edit-tags.php', 'acfe_dt_admin_footer', 99);
580 function acfe_dt_admin_footer(){
581
582 if(!current_user_can(acf_get_setting('capability')))
583 return;
584
585 // Get taxonomy
586 global $taxnow;
587
588 // Check taxonomy
589 $taxonomy = $taxnow;
590 if(empty($taxonomy))
591 return;
592
593 // Taxonomy object
594 $taxonomy_obj = get_taxonomy($taxonomy);
595 if(!isset($taxonomy_obj->acfe_admin_ppp))
596 return;
597
598 // Get Dynamic Post Type Post
599 $acfe_dt_post_type = get_page_by_path($taxonomy, 'OBJECT', 'acfe-dt');
600
601 if(empty($acfe_dt_post_type))
602 return;
603
604 ?>
605 <script type="text/html" id="tmpl-acfe-dt-title-config">
606 &nbsp;<a href="<?php echo admin_url('post.php?post=' . $acfe_dt_post_type->ID . '&action=edit'); ?>" class="page-title-action acfe-dt-admin-config"><span class="dashicons dashicons-admin-generic"></span></a>
607 </script>
608
609 <script type="text/javascript">
610 (function($){
611
612 // Add button
613 $('.wrap .wp-heading-inline').after($('#tmpl-acfe-dt-title-config').html());
614
615 })(jQuery);
616 </script>
617 <?php
618
619 }
620
621 add_filter('enter_title_here', 'acfe_dt_admin_placeholder_title', 10, 2);
622 function acfe_dt_admin_placeholder_title($placeholder, $post){
623
624 // Get post type
625 global $typenow;
626
627 // Check post type
628 $post_type = $typenow;
629 if($post_type !== 'acfe-dt')
630 return $placeholder;
631
632 return 'Taxonomy Name';
633
634 }
635
636 add_action('admin_footer-post.php', 'acfe_dt_admin_validate_title');
637 function acfe_dt_admin_validate_title(){
638
639 // Get post type
640 global $typenow;
641
642 // Check post type
643 $post_type = $typenow;
644 if($post_type !== 'acfe-dt')
645 return;
646
647 ?>
648 <script type="text/javascript">
649 (function($){
650
651 if(typeof acf === 'undefined')
652 return;
653
654 $('#post').submit(function(e){
655
656 // vars
657 var $title = $('#titlewrap #title');
658
659 // empty
660 if(!$title.val()){
661
662 // prevent default
663 e.preventDefault();
664
665 // alert
666 alert('Taxonomy Name is required.');
667
668 // focus
669 $title.focus();
670
671 }
672
673 });
674
675 })(jQuery);
676 </script>
677 <?php
678 }
679
680 /**
681 * Admin Validate Name
682 */
683 add_filter('acf/validate_value/name=acfe_dt_name', 'acfe_dt_admin_validate_name', 10, 4);
684 function acfe_dt_admin_validate_name($valid, $value, $field, $input){
685
686 if(!$valid)
687 return $valid;
688
689 // Reserved taxonomies
690 $excludes = array(
691
692 // Reserved WP Taxonomies: https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms
693 'attachment',
694 'attachment_id',
695 'author',
696 'author_name',
697 'calendar',
698 'cat',
699 'category',
700 'category__and',
701 'category__in',
702 'category__not_in',
703 'category_name',
704 'comments_per_page',
705 'comments_popup',
706 'customize_messenger_channel',
707 'customized',
708 'cpage',
709 'day',
710 'debug',
711 'error',
712 'exact',
713 'feed',
714 'fields',
715 'hour',
716 'link_category',
717 'm',
718 'minute',
719 'monthnum',
720 'more',
721 'name',
722 'nav_menu',
723 'nonce',
724 'nopaging',
725 'offset',
726 'order',
727 'orderby',
728 'p',
729 'page',
730 'page_id',
731 'paged',
732 'pagename',
733 'pb',
734 'perm',
735 'post',
736 'post__in',
737 'post__not_in',
738 'post_format',
739 'post_mime_type',
740 'post_status',
741 'post_tag',
742 'post_type',
743 'posts',
744 'posts_per_archive_page',
745 'posts_per_page',
746 'preview',
747 'robots',
748 's',
749 'search',
750 'second',
751 'sentence',
752 'showposts',
753 'static',
754 'subpost',
755 'subpost_id',
756 'tag',
757 'tag__and',
758 'tag__in',
759 'tag__not_in',
760 'tag_id',
761 'tag_slug__and',
762 'tag_slug__in',
763 'taxonomy',
764 'tb',
765 'term',
766 'theme',
767 'type',
768 'w',
769 'withcomments',
770 'withoutcomments',
771 'year',
772
773 // ACF Extended
774 'acf-field-group-category',
775
776 );
777
778 // Reserved Names
779 if(in_array($value, $excludes))
780 return __('This taxonomy name is reserved');
781
782 // Editing Current Dynamic Taxonomy
783 $current_post_id = acf_maybe_get_POST('post_ID');
784
785 if(!empty($current_post_id)){
786
787 $current_name = get_field($field['name'], $current_post_id);
788
789 if($value === $current_name)
790 return $valid;
791
792 }
793
794 // Check existing WP Taxonomies
795 global $wp_taxonomies;
796
797 if(!empty($wp_taxonomies)){
798
799 foreach($wp_taxonomies as $taxonomy){
800
801 if($value !== $taxonomy->name)
802 continue;
803
804 $valid = __('This taxonomy name already exists');
805
806 }
807
808 }
809
810 return $valid;
811
812 }
813
814 add_filter('acf/update_value/name=acfe_dt_name', 'acfe_dt_admin_update_name', 10, 3);
815 function acfe_dt_admin_update_name($value, $post_id, $field){
816
817 // Previous value
818 $_value = get_field($field['name'], $post_id);
819
820 // Value Changed. Delete option
821 if($_value !== $value){
822
823 acfe_settings()->delete('modules.dynamic_taxonomy.data.' . $_value);
824
825 }
826
827 return $value;
828
829 }
830
831 /**
832 * Add Local Field Group
833 */
834 acf_add_local_field_group(array(
835 'key' => 'group_acfe_dynamic_taxonomy',
836 'title' => __('Dynamic Taxonomy', 'acfe'),
837
838 'location' => array(
839 array(
840 array(
841 'param' => 'post_type',
842 'operator' => '==',
843 'value' => 'acfe-dt',
844 ),
845 ),
846 ),
847
848 'menu_order' => 0,
849 'position' => 'normal',
850 'style' => 'default',
851 'label_placement' => 'left',
852 'instruction_placement' => 'label',
853 'hide_on_screen' => '',
854 'active' => 1,
855 'description' => '',
856
857 'fields' => array(
858 array(
859 'key' => 'field_acfe_dt_tab_general',
860 'label' => 'General',
861 'name' => '',
862 'type' => 'tab',
863 'instructions' => '',
864 'required' => 0,
865 'conditional_logic' => 0,
866 'wrapper' => array(
867 'width' => '',
868 'class' => '',
869 'id' => '',
870 'data-no-preference' => true,
871 ),
872 'acfe_permissions' => '',
873 'placement' => 'top',
874 'endpoint' => 0,
875 ),
876 array(
877 'key' => 'field_acfe_dt_name',
878 'label' => 'Name',
879 'name' => 'acfe_dt_name',
880 'type' => 'acfe_slug',
881 'instructions' => 'The name of the taxonomy. Name should only contain lowercase letters and the underscore character, and not be more than 32 characters long (database structure restriction)',
882 'required' => 1,
883 'conditional_logic' => 0,
884 'wrapper' => array(
885 'width' => '',
886 'class' => '',
887 'id' => '',
888 ),
889 'acfe_validate' => '',
890 'acfe_update' => '',
891 'acfe_permissions' => '',
892 'default_value' => '',
893 'placeholder' => '',
894 'prepend' => '',
895 'append' => '',
896 'maxlength' => 32,
897 ),
898 array(
899 'key' => 'field_acfe_dt_description',
900 'label' => 'Description',
901 'name' => 'description',
902 'type' => 'text',
903 'instructions' => 'Include a description of the taxonomy',
904 'required' => 0,
905 'conditional_logic' => 0,
906 'wrapper' => array(
907 'width' => '',
908 'class' => '',
909 'id' => '',
910 ),
911 'acfe_validate' => '',
912 'acfe_update' => '',
913 'acfe_permissions' => '',
914 'default_value' => '',
915 'placeholder' => '',
916 'prepend' => '',
917 'append' => '',
918 'maxlength' => '',
919 ),
920 array(
921 'key' => 'field_acfe_dt_hierarchical',
922 'label' => 'Hierarchical',
923 'name' => 'hierarchical',
924 'type' => 'true_false',
925 'instructions' => 'Is this taxonomy hierarchical (have descendants) like categories or not hierarchical like tags',
926 'required' => 0,
927 'conditional_logic' => 0,
928 'wrapper' => array(
929 'width' => '',
930 'class' => '',
931 'id' => '',
932 ),
933 'acfe_validate' => '',
934 'acfe_update' => '',
935 'acfe_permissions' => '',
936 'message' => '',
937 'default_value' => 0,
938 'ui' => 1,
939 'ui_on_text' => '',
940 'ui_off_text' => '',
941 ),
942 array(
943 'key' => 'field_acfe_dt_post_types',
944 'label' => 'Post types',
945 'name' => 'post_types',
946 'type' => 'acfe_post_types',
947 'instructions' => '',
948 'required' => 0,
949 'conditional_logic' => 0,
950 'wrapper' => array(
951 'width' => '',
952 'class' => '',
953 'id' => '',
954 ),
955 'acfe_validate' => '',
956 'acfe_update' => '',
957 'acfe_permissions' => '',
958 'field_type' => 'checkbox',
959 'return_format' => 'name',
960 ),
961 array(
962 'key' => 'field_acfe_dt_public',
963 'label' => 'Public',
964 'name' => 'public',
965 'type' => 'true_false',
966 'instructions' => 'Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users',
967 'required' => 0,
968 'conditional_logic' => 0,
969 'wrapper' => array(
970 'width' => '',
971 'class' => '',
972 'id' => '',
973 ),
974 'acfe_validate' => '',
975 'acfe_update' => '',
976 'acfe_permissions' => '',
977 'message' => '',
978 'default_value' => 1,
979 'ui' => 1,
980 'ui_on_text' => '',
981 'ui_off_text' => '',
982 ),
983 array(
984 'key' => 'field_acfe_dt_publicly_queryable',
985 'label' => 'Publicly queryable',
986 'name' => 'publicly_queryable',
987 'type' => 'true_false',
988 'instructions' => 'Whether the taxonomy is publicly queryable',
989 'required' => 0,
990 'conditional_logic' => 0,
991 'wrapper' => array(
992 'width' => '',
993 'class' => '',
994 'id' => '',
995 ),
996 'acfe_validate' => '',
997 'acfe_update' => '',
998 'acfe_permissions' => '',
999 'message' => '',
1000 'default_value' => 1,
1001 'ui' => 1,
1002 'ui_on_text' => '',
1003 'ui_off_text' => '',
1004 ),
1005 array(
1006 'key' => 'field_acfe_dt_update_count_callback',
1007 'label' => 'Update count callback',
1008 'name' => 'update_count_callback',
1009 'type' => 'text',
1010 'instructions' => 'A function name that will be called when the count of an associated $object_type, such as post, is updated',
1011 'required' => 0,
1012 'conditional_logic' => 0,
1013 'wrapper' => array(
1014 'width' => '',
1015 'class' => '',
1016 'id' => '',
1017 ),
1018 'acfe_validate' => '',
1019 'acfe_update' => '',
1020 'acfe_permissions' => '',
1021 'default_value' => '',
1022 'placeholder' => '',
1023 'prepend' => '',
1024 'append' => '',
1025 'maxlength' => '',
1026 ),
1027 array(
1028 'key' => 'field_acfe_dt_meta_box_cb',
1029 'label' => 'Meta box callback',
1030 'name' => 'meta_box_cb',
1031 'type' => 'select',
1032 'instructions' => 'Provide a callback function name for the meta box display.<br /><br/>Defaults to the categories meta box for hierarchical taxonomies and the tags meta box for non-hierarchical taxonomies. No meta box is shown if set to false.',
1033 'required' => 0,
1034 'conditional_logic' => 0,
1035 'wrapper' => array(
1036 'width' => '',
1037 'class' => '',
1038 'id' => '',
1039 ),
1040 'acfe_validate' => '',
1041 'acfe_update' => '',
1042 'acfe_permissions' => '',
1043 'choices' => array(
1044 'null' => 'Null (default)',
1045 'false' => 'False',
1046 'custom' => 'Custom',
1047 ),
1048 'default_value' => array(
1049 0 => 'null',
1050 ),
1051 'allow_null' => 0,
1052 'multiple' => 0,
1053 'ui' => 0,
1054 'return_format' => 'value',
1055 'ajax' => 0,
1056 'placeholder' => '',
1057 ),
1058 array(
1059 'key' => 'field_acfe_dt_meta_box_cb_custom',
1060 'label' => 'Meta box callback',
1061 'name' => 'meta_box_cb_custom',
1062 'type' => 'text',
1063 'instructions' => '',
1064 'required' => 0,
1065 'wrapper' => array(
1066 'width' => '',
1067 'class' => '',
1068 'id' => '',
1069 ),
1070 'acfe_validate' => '',
1071 'acfe_update' => '',
1072 'acfe_permissions' => '',
1073 'default_value' => '',
1074 'placeholder' => '',
1075 'prepend' => '',
1076 'append' => '',
1077 'maxlength' => '',
1078 'conditional_logic' => array(
1079 array(
1080 array(
1081 'field' => 'field_acfe_dt_meta_box_cb',
1082 'operator' => '==',
1083 'value' => 'custom',
1084 )
1085 )
1086 )
1087 ),
1088 array(
1089 'key' => 'field_acfe_dt_sort',
1090 'label' => 'Sort',
1091 'name' => 'sort',
1092 'type' => 'true_false',
1093 'instructions' => 'Whether this taxonomy should remember the order in which terms are added to objects',
1094 'required' => 0,
1095 'conditional_logic' => 0,
1096 'wrapper' => array(
1097 'width' => '',
1098 'class' => '',
1099 'id' => '',
1100 ),
1101 'acfe_validate' => '',
1102 'acfe_update' => '',
1103 'acfe_permissions' => '',
1104 'message' => '',
1105 'default_value' => 0,
1106 'ui' => 1,
1107 'ui_on_text' => '',
1108 'ui_off_text' => '',
1109 ),
1110 array(
1111 'key' => 'field_acfe_dt_tab_menu',
1112 'label' => 'Menu',
1113 'name' => '',
1114 'type' => 'tab',
1115 'instructions' => '',
1116 'required' => 0,
1117 'conditional_logic' => 0,
1118 'wrapper' => array(
1119 'width' => '',
1120 'class' => '',
1121 'id' => '',
1122 ),
1123 'acfe_permissions' => '',
1124 'placement' => 'top',
1125 'endpoint' => 0,
1126 ),
1127 array(
1128 'key' => 'field_acfe_dt_show_ui',
1129 'label' => 'Show UI',
1130 'name' => 'show_ui',
1131 'type' => 'true_false',
1132 'instructions' => 'Whether to generate a default UI for managing this post type in the admin',
1133 'required' => 0,
1134 'conditional_logic' => 0,
1135 'wrapper' => array(
1136 'width' => '',
1137 'class' => '',
1138 'id' => '',
1139 ),
1140 'acfe_validate' => '',
1141 'acfe_update' => '',
1142 'acfe_permissions' => '',
1143 'message' => '',
1144 'default_value' => 1,
1145 'ui' => 1,
1146 'ui_on_text' => '',
1147 'ui_off_text' => '',
1148 ),
1149 array(
1150 'key' => 'field_acfe_dt_show_in_menu',
1151 'label' => 'Show in menu',
1152 'name' => 'show_in_menu',
1153 'type' => 'true_false',
1154 'instructions' => 'Where to show the taxonomy in the admin menu. show_ui must be true',
1155 'required' => 0,
1156 'conditional_logic' => 0,
1157 'wrapper' => array(
1158 'width' => '',
1159 'class' => '',
1160 'id' => '',
1161 ),
1162 'acfe_validate' => '',
1163 'acfe_update' => '',
1164 'acfe_permissions' => '',
1165 'message' => '',
1166 'default_value' => 1,
1167 'ui' => 1,
1168 'ui_on_text' => '',
1169 'ui_off_text' => '',
1170 ),
1171 array(
1172 'key' => 'field_acfe_dt_show_in_nav_menus',
1173 'label' => 'Show in nav menus',
1174 'name' => 'show_in_nav_menus',
1175 'type' => 'true_false',
1176 'instructions' => 'true makes this taxonomy available for selection in navigation menus',
1177 'required' => 0,
1178 'conditional_logic' => 0,
1179 'wrapper' => array(
1180 'width' => '',
1181 'class' => '',
1182 'id' => '',
1183 ),
1184 'acfe_validate' => '',
1185 'acfe_update' => '',
1186 'acfe_permissions' => '',
1187 'message' => '',
1188 'default_value' => 1,
1189 'ui' => 1,
1190 'ui_on_text' => '',
1191 'ui_off_text' => '',
1192 ),
1193 array(
1194 'key' => 'field_acfe_dt_show_tagcloud',
1195 'label' => 'Show tagcloud',
1196 'name' => 'show_tagcloud',
1197 'type' => 'true_false',
1198 'instructions' => 'Whether to allow the Tag Cloud widget to use this taxonomy',
1199 'required' => 0,
1200 'conditional_logic' => 0,
1201 'wrapper' => array(
1202 'width' => '',
1203 'class' => '',
1204 'id' => '',
1205 ),
1206 'acfe_validate' => '',
1207 'acfe_update' => '',
1208 'acfe_permissions' => '',
1209 'message' => '',
1210 'default_value' => 1,
1211 'ui' => 1,
1212 'ui_on_text' => '',
1213 'ui_off_text' => '',
1214 ),
1215 array(
1216 'key' => 'field_acfe_dt_show_in_quick_edit',
1217 'label' => 'Show in quick edit',
1218 'name' => 'show_in_quick_edit',
1219 'type' => 'true_false',
1220 'instructions' => 'Whether to show the taxonomy in the quick/bulk edit panel',
1221 'required' => 0,
1222 'conditional_logic' => 0,
1223 'wrapper' => array(
1224 'width' => '',
1225 'class' => '',
1226 'id' => '',
1227 ),
1228 'acfe_validate' => '',
1229 'acfe_update' => '',
1230 'acfe_permissions' => '',
1231 'message' => '',
1232 'default_value' => 1,
1233 'ui' => 1,
1234 'ui_on_text' => '',
1235 'ui_off_text' => '',
1236 ),
1237 array(
1238 'key' => 'field_acfe_dt_show_admin_column',
1239 'label' => 'Show admin column',
1240 'name' => 'show_admin_column',
1241 'type' => 'true_false',
1242 'instructions' => 'Whether to allow automatic creation of taxonomy columns on associated post-types table',
1243 'required' => 0,
1244 'conditional_logic' => 0,
1245 'wrapper' => array(
1246 'width' => '',
1247 'class' => '',
1248 'id' => '',
1249 ),
1250 'acfe_validate' => '',
1251 'acfe_update' => '',
1252 'acfe_permissions' => '',
1253 'message' => '',
1254 'default_value' => 1,
1255 'ui' => 1,
1256 'ui_on_text' => '',
1257 'ui_off_text' => '',
1258 ),
1259 array(
1260 'key' => 'field_acfe_dt_tab_single',
1261 'label' => 'Single',
1262 'name' => '',
1263 'type' => 'tab',
1264 'instructions' => '',
1265 'required' => 0,
1266 'conditional_logic' => 0,
1267 'wrapper' => array(
1268 'width' => '',
1269 'class' => '',
1270 'id' => '',
1271 ),
1272 'acfe_permissions' => '',
1273 'placement' => 'top',
1274 'endpoint' => 0,
1275 ),
1276 array(
1277 'key' => 'field_acfe_dt_single_template',
1278 'label' => 'Template',
1279 'name' => 'acfe_dt_single_template',
1280 'type' => 'text',
1281 'instructions' => 'ACF Extended: Which template file to load for the term query. More informations on <a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">Template hierarchy</a>',
1282 'required' => 0,
1283 'conditional_logic' => 0,
1284 'wrapper' => array(
1285 'width' => '',
1286 'class' => '',
1287 'id' => '',
1288 ),
1289 'acfe_validate' => '',
1290 'acfe_update' => '',
1291 'acfe_permissions' => '',
1292 'default_value' => '',
1293 'placeholder' => 'my-template.php',
1294 'prepend' => trailingslashit(acfe_get_setting('theme_folder')),
1295 'append' => '',
1296 'maxlength' => '',
1297 ),
1298 array(
1299 'key' => 'field_acfe_dt_single_posts_per_page',
1300 'label' => 'Posts per page',
1301 'name' => 'acfe_dt_single_posts_per_page',
1302 'type' => 'number',
1303 'instructions' => 'ACF Extended: Number of posts to display on the admin list screen',
1304 'required' => 0,
1305 'conditional_logic' => 0,
1306 'wrapper' => array(
1307 'width' => '',
1308 'class' => '',
1309 'id' => '',
1310 ),
1311 'acfe_validate' => '',
1312 'acfe_update' => '',
1313 'acfe_permissions' => '',
1314 'default_value' => 10,
1315 'placeholder' => '',
1316 'prepend' => '',
1317 'append' => '',
1318 'min' => -1,
1319 'max' => '',
1320 'step' => '',
1321 ),
1322 array(
1323 'key' => 'field_acfe_dt_single_orderby',
1324 'label' => 'Order by',
1325 'name' => 'acfe_dt_single_orderby',
1326 'type' => 'text',
1327 'instructions' => 'ACF Extended: Sort retrieved posts by parameter in the admin list screen. Defaults to \'date (post_date)\'.',
1328 'required' => 0,
1329 'conditional_logic' => 0,
1330 'wrapper' => array(
1331 'width' => '',
1332 'class' => '',
1333 'id' => '',
1334 ),
1335 'acfe_validate' => '',
1336 'acfe_update' => array(
1337 '5c9479dec93c4' => array(
1338 'acfe_update_function' => 'sanitize_title',
1339 ),
1340 ),
1341 'acfe_permissions' => '',
1342 'default_value' => 'date',
1343 'placeholder' => '',
1344 'prepend' => '',
1345 'append' => '',
1346 'maxlength' => '',
1347 ),
1348 array(
1349 'key' => 'field_acfe_dt_single_order',
1350 'label' => 'Order',
1351 'name' => 'acfe_dt_single_order',
1352 'type' => 'select',
1353 'instructions' => 'ACF Extended: Designates the ascending or descending order of the \'orderby\' parameter in the admin list screen. Defaults to \'DESC\'.',
1354 'required' => 0,
1355 'conditional_logic' => 0,
1356 'wrapper' => array(
1357 'width' => '',
1358 'class' => '',
1359 'id' => '',
1360 ),
1361 'acfe_validate' => '',
1362 'acfe_update' => '',
1363 'acfe_permissions' => '',
1364 'choices' => array(
1365 'ASC' => 'ASC',
1366 'DESC' => 'DESC',
1367 ),
1368 'default_value' => array(
1369 0 => 'DESC',
1370 ),
1371 'allow_null' => 0,
1372 'multiple' => 0,
1373 'ui' => 0,
1374 'return_format' => 'value',
1375 'ajax' => 0,
1376 'placeholder' => '',
1377 ),
1378 array(
1379 'key' => 'field_acfe_dt_rewrite',
1380 'label' => 'Rewrite',
1381 'name' => 'rewrite',
1382 'type' => 'true_false',
1383 'instructions' => 'Set to false to prevent automatic URL rewriting a.k.a. "pretty permalinks". Pass an argument array to override default URL settings for permalinks',
1384 'required' => 0,
1385 'conditional_logic' => 0,
1386 'wrapper' => array(
1387 'width' => '',
1388 'class' => '',
1389 'id' => '',
1390 ),
1391 'acfe_validate' => '',
1392 'acfe_update' => '',
1393 'acfe_permissions' => '',
1394 'message' => '',
1395 'default_value' => 1,
1396 'ui' => 1,
1397 'ui_on_text' => '',
1398 'ui_off_text' => '',
1399 ),
1400 array(
1401 'key' => 'field_acfe_dt_rewrite_args_select',
1402 'label' => 'Rewrite Arguments',
1403 'name' => 'rewrite_args_select',
1404 'type' => 'true_false',
1405 'instructions' => 'Use additional rewrite arguments',
1406 'required' => 0,
1407 'conditional_logic' => array(
1408 array(
1409 array(
1410 'field' => 'field_acfe_dt_rewrite',
1411 'operator' => '==',
1412 'value' => '1',
1413 ),
1414 ),
1415 ),
1416 'wrapper' => array(
1417 'width' => '',
1418 'class' => '',
1419 'id' => '',
1420 ),
1421 'acfe_validate' => '',
1422 'acfe_update' => '',
1423 'acfe_permissions' => '',
1424 'message' => '',
1425 'default_value' => 0,
1426 'ui' => 1,
1427 'ui_on_text' => '',
1428 'ui_off_text' => '',
1429 ),
1430 array(
1431 'key' => 'field_acfe_dt_rewrite_args',
1432 'label' => 'Rewrite Arguments',
1433 'name' => 'rewrite_args',
1434 'type' => 'group',
1435 'instructions' => 'Additional arguments',
1436 'required' => 0,
1437 'conditional_logic' => array(
1438 array(
1439 array(
1440 'field' => 'field_acfe_dt_rewrite',
1441 'operator' => '==',
1442 'value' => '1',
1443 ),
1444 array(
1445 'field' => 'field_acfe_dt_rewrite_args_select',
1446 'operator' => '==',
1447 'value' => '1',
1448 ),
1449 ),
1450 ),
1451 'wrapper' => array(
1452 'width' => '',
1453 'class' => '',
1454 'id' => '',
1455 ),
1456 'acfe_permissions' => '',
1457 'layout' => 'row',
1458 'sub_fields' => array(
1459 array(
1460 'key' => 'field_acfe_dt_rewrite_slug',
1461 'label' => 'Slug',
1462 'name' => 'acfe_dt_rewrite_slug',
1463 'type' => 'text',
1464 'instructions' => 'Used as pretty permalink text (i.e. /tag/) - defaults to $taxonomy (taxonomy\'s name slug)',
1465 'required' => 0,
1466 'conditional_logic' => array(
1467 array(
1468 array(
1469 'field' => 'field_acfe_dt_rewrite_args_select',
1470 'operator' => '==',
1471 'value' => '1',
1472 ),
1473 ),
1474 ),
1475 'wrapper' => array(
1476 'width' => '',
1477 'class' => '',
1478 'id' => '',
1479 ),
1480 'acfe_validate' => '',
1481 'acfe_update' => '',
1482 'acfe_permissions' => '',
1483 'default_value' => '',
1484 'placeholder' => 'Default',
1485 'prepend' => '',
1486 'append' => '',
1487 'maxlength' => '',
1488 ),
1489 array(
1490 'key' => 'field_acfe_dt_rewrite_with_front',
1491 'label' => 'With front',
1492 'name' => 'acfe_dt_rewrite_with_front',
1493 'type' => 'true_false',
1494 'instructions' => 'Allowing permalinks to be prepended with front base',
1495 'required' => 0,
1496 'conditional_logic' => array(
1497 array(
1498 array(
1499 'field' => 'field_acfe_dt_rewrite_args_select',
1500 'operator' => '==',
1501 'value' => '1',
1502 ),
1503 ),
1504 ),
1505 'wrapper' => array(
1506 'width' => '',
1507 'class' => '',
1508 'id' => '',
1509 ),
1510 'acfe_validate' => '',
1511 'acfe_update' => '',
1512 'acfe_permissions' => '',
1513 'message' => '',
1514 'default_value' => 1,
1515 'ui' => 1,
1516 'ui_on_text' => '',
1517 'ui_off_text' => '',
1518 ),
1519 array(
1520 'key' => 'field_acfe_dt_rewrite_hierarchical',
1521 'label' => 'Hierarchical',
1522 'name' => 'hierarchical',
1523 'type' => 'true_false',
1524 'instructions' => 'True or false allow hierarchical urls',
1525 'required' => 0,
1526 'conditional_logic' => array(
1527 array(
1528 array(
1529 'field' => 'field_acfe_dt_rewrite_args_select',
1530 'operator' => '==',
1531 'value' => '1',
1532 ),
1533 ),
1534 ),
1535 'wrapper' => array(
1536 'width' => '',
1537 'class' => '',
1538 'id' => '',
1539 ),
1540 'acfe_validate' => '',
1541 'acfe_update' => '',
1542 'acfe_permissions' => '',
1543 'message' => '',
1544 'default_value' => 0,
1545 'ui' => 1,
1546 'ui_on_text' => '',
1547 'ui_off_text' => '',
1548 ),
1549 ),
1550 ),
1551 array(
1552 'key' => 'field_acfe_dt_tab_admin',
1553 'label' => 'Admin',
1554 'name' => '',
1555 'type' => 'tab',
1556 'instructions' => '',
1557 'required' => 0,
1558 'conditional_logic' => 0,
1559 'wrapper' => array(
1560 'width' => '',
1561 'class' => '',
1562 'id' => '',
1563 ),
1564 'acfe_permissions' => '',
1565 'placement' => 'top',
1566 'endpoint' => 0,
1567 ),
1568 array(
1569 'key' => 'field_acfe_dt_admin_terms_per_page',
1570 'label' => 'Terms per page',
1571 'name' => 'acfe_dt_admin_terms_per_page',
1572 'type' => 'number',
1573 'instructions' => 'ACF Extended: Number of terms to display on the admin list screen',
1574 'required' => 0,
1575 'conditional_logic' => 0,
1576 'wrapper' => array(
1577 'width' => '',
1578 'class' => '',
1579 'id' => '',
1580 ),
1581 'acfe_validate' => '',
1582 'acfe_update' => '',
1583 'acfe_permissions' => '',
1584 'default_value' => 10,
1585 'placeholder' => '',
1586 'prepend' => '',
1587 'append' => '',
1588 'min' => -1,
1589 'max' => '',
1590 'step' => '',
1591 ),
1592 array(
1593 'key' => 'field_acfe_dt_admin_orderby',
1594 'label' => 'Order by',
1595 'name' => 'acfe_dt_admin_orderby',
1596 'type' => 'text',
1597 'instructions' => 'ACF Extended: Sort retrieved terms by parameter in the admin list screen. Accepts term fields \'name\', \'slug\', \'term_group\', \'term_id\', \'id\', \'description\', \'parent\', \'count\' (for term taxonomy count), or \'none\' to omit the ORDER BY clause',
1598 'required' => 0,
1599 'conditional_logic' => 0,
1600 'wrapper' => array(
1601 'width' => '',
1602 'class' => '',
1603 'id' => '',
1604 ),
1605 'acfe_validate' => '',
1606 'acfe_update' => array(
1607 '5c9479dec93c4' => array(
1608 'acfe_update_function' => 'sanitize_title',
1609 ),
1610 ),
1611 'acfe_permissions' => '',
1612 'default_value' => 'name',
1613 'placeholder' => '',
1614 'prepend' => '',
1615 'append' => '',
1616 'maxlength' => '',
1617 ),
1618 array(
1619 'key' => 'field_acfe_dt_admin_order',
1620 'label' => 'Order',
1621 'name' => 'acfe_dt_admin_order',
1622 'type' => 'select',
1623 'instructions' => 'ACF Extended: Designates the ascending or descending order of the \'orderby\' parameter in the admin list screen. Defaults to \'ASC\'.',
1624 'required' => 0,
1625 'conditional_logic' => 0,
1626 'wrapper' => array(
1627 'width' => '',
1628 'class' => '',
1629 'id' => '',
1630 ),
1631 'acfe_validate' => '',
1632 'acfe_update' => '',
1633 'acfe_permissions' => '',
1634 'choices' => array(
1635 'ASC' => 'ASC',
1636 'DESC' => 'DESC',
1637 ),
1638 'default_value' => array(
1639 0 => 'ASC',
1640 ),
1641 'allow_null' => 0,
1642 'multiple' => 0,
1643 'ui' => 0,
1644 'return_format' => 'value',
1645 'ajax' => 0,
1646 'placeholder' => '',
1647 ),
1648 array(
1649 'key' => 'field_acfe_dt_tab_labels',
1650 'label' => 'Labels',
1651 'name' => '',
1652 'type' => 'tab',
1653 'instructions' => '',
1654 'required' => 0,
1655 'conditional_logic' => 0,
1656 'wrapper' => array(
1657 'width' => '',
1658 'class' => '',
1659 'id' => '',
1660 ),
1661 'acfe_permissions' => '',
1662 'placement' => 'top',
1663 'endpoint' => 0,
1664 ),
1665 array(
1666 'key' => 'field_acfe_dt_labels',
1667 'label' => 'Labels',
1668 'name' => 'labels',
1669 'type' => 'group',
1670 'instructions' => 'An array of labels for this taxonomy. By default tag labels are used for non-hierarchical types and category labels for hierarchical ones.<br /><br />
1671 Default: if empty, name is set to label value, and singular_name is set to name value.',
1672 'required' => 0,
1673 'conditional_logic' => 0,
1674 'wrapper' => array(
1675 'width' => '',
1676 'class' => '',
1677 'id' => '',
1678 ),
1679 'acfe_permissions' => '',
1680 'layout' => 'row',
1681 'sub_fields' => array(
1682 array(
1683 'key' => 'field_acfe_dt_singular_name',
1684 'label' => 'Singular name',
1685 'name' => 'singular_name',
1686 'type' => 'text',
1687 'instructions' => '',
1688 'required' => 0,
1689 'conditional_logic' => 0,
1690 'wrapper' => array(
1691 'width' => '',
1692 'class' => '',
1693 'id' => '',
1694 ),
1695 'acfe_validate' => '',
1696 'acfe_update' => '',
1697 'acfe_permissions' => '',
1698 'default_value' => '',
1699 'placeholder' => '',
1700 'prepend' => '',
1701 'append' => '',
1702 'maxlength' => '',
1703 ),
1704 array(
1705 'key' => 'field_acfe_dt_menu_name',
1706 'label' => 'Menu name',
1707 'name' => 'menu_name',
1708 'type' => 'text',
1709 'instructions' => '',
1710 'required' => 0,
1711 'conditional_logic' => 0,
1712 'wrapper' => array(
1713 'width' => '',
1714 'class' => '',
1715 'id' => '',
1716 ),
1717 'acfe_validate' => '',
1718 'acfe_update' => '',
1719 'acfe_permissions' => '',
1720 'default_value' => '',
1721 'placeholder' => '',
1722 'prepend' => '',
1723 'append' => '',
1724 'maxlength' => '',
1725 ),
1726 array(
1727 'key' => 'field_acfe_dt_all_items',
1728 'label' => 'All items',
1729 'name' => 'all_items',
1730 'type' => 'text',
1731 'instructions' => '',
1732 'required' => 0,
1733 'conditional_logic' => 0,
1734 'wrapper' => array(
1735 'width' => '',
1736 'class' => '',
1737 'id' => '',
1738 ),
1739 'acfe_validate' => '',
1740 'acfe_update' => '',
1741 'acfe_permissions' => '',
1742 'default_value' => '',
1743 'placeholder' => '',
1744 'prepend' => '',
1745 'append' => '',
1746 'maxlength' => '',
1747 ),
1748 array(
1749 'key' => 'field_acfe_dt_edit_item',
1750 'label' => 'Edit item',
1751 'name' => 'edit_item',
1752 'type' => 'text',
1753 'instructions' => '',
1754 'required' => 0,
1755 'conditional_logic' => 0,
1756 'wrapper' => array(
1757 'width' => '',
1758 'class' => '',
1759 'id' => '',
1760 ),
1761 'acfe_validate' => '',
1762 'acfe_update' => '',
1763 'acfe_permissions' => '',
1764 'default_value' => '',
1765 'placeholder' => '',
1766 'prepend' => '',
1767 'append' => '',
1768 'maxlength' => '',
1769 ),
1770 array(
1771 'key' => 'field_acfe_dt_view_item',
1772 'label' => 'View item',
1773 'name' => 'view_item',
1774 'type' => 'text',
1775 'instructions' => '',
1776 'required' => 0,
1777 'conditional_logic' => 0,
1778 'wrapper' => array(
1779 'width' => '',
1780 'class' => '',
1781 'id' => '',
1782 ),
1783 'acfe_validate' => '',
1784 'acfe_update' => '',
1785 'acfe_permissions' => '',
1786 'default_value' => '',
1787 'placeholder' => '',
1788 'prepend' => '',
1789 'append' => '',
1790 'maxlength' => '',
1791 ),
1792 array(
1793 'key' => 'field_acfe_dt_update_item',
1794 'label' => 'Update item',
1795 'name' => 'update_item',
1796 'type' => 'text',
1797 'instructions' => '',
1798 'required' => 0,
1799 'conditional_logic' => 0,
1800 'wrapper' => array(
1801 'width' => '',
1802 'class' => '',
1803 'id' => '',
1804 ),
1805 'acfe_validate' => '',
1806 'acfe_update' => '',
1807 'acfe_permissions' => '',
1808 'default_value' => '',
1809 'placeholder' => '',
1810 'prepend' => '',
1811 'append' => '',
1812 'maxlength' => '',
1813 ),
1814 array(
1815 'key' => 'field_acfe_dt_add_new_item',
1816 'label' => 'Add new item',
1817 'name' => 'add_new_item',
1818 'type' => 'text',
1819 'instructions' => '',
1820 'required' => 0,
1821 'conditional_logic' => 0,
1822 'wrapper' => array(
1823 'width' => '',
1824 'class' => '',
1825 'id' => '',
1826 ),
1827 'acfe_validate' => '',
1828 'acfe_update' => '',
1829 'acfe_permissions' => '',
1830 'default_value' => '',
1831 'placeholder' => '',
1832 'prepend' => '',
1833 'append' => '',
1834 'maxlength' => '',
1835 ),
1836 array(
1837 'key' => 'field_acfe_dt_new_item_name',
1838 'label' => 'New item name',
1839 'name' => 'new_item_name',
1840 'type' => 'text',
1841 'instructions' => '',
1842 'required' => 0,
1843 'conditional_logic' => 0,
1844 'wrapper' => array(
1845 'width' => '',
1846 'class' => '',
1847 'id' => '',
1848 ),
1849 'acfe_validate' => '',
1850 'acfe_update' => '',
1851 'acfe_permissions' => '',
1852 'default_value' => '',
1853 'placeholder' => '',
1854 'prepend' => '',
1855 'append' => '',
1856 'maxlength' => '',
1857 ),
1858 array(
1859 'key' => 'field_acfe_dt_parent_item',
1860 'label' => 'Parent item',
1861 'name' => 'parent_item',
1862 'type' => 'text',
1863 'instructions' => '',
1864 'required' => 0,
1865 'conditional_logic' => 0,
1866 'wrapper' => array(
1867 'width' => '',
1868 'class' => '',
1869 'id' => '',
1870 ),
1871 'acfe_validate' => '',
1872 'acfe_update' => '',
1873 'acfe_permissions' => '',
1874 'default_value' => '',
1875 'placeholder' => '',
1876 'prepend' => '',
1877 'append' => '',
1878 'maxlength' => '',
1879 ),
1880 array(
1881 'key' => 'field_acfe_dt_parent_item_colon',
1882 'label' => 'Parent item colon',
1883 'name' => 'parent_item_colon',
1884 'type' => 'text',
1885 'instructions' => '',
1886 'required' => 0,
1887 'conditional_logic' => 0,
1888 'wrapper' => array(
1889 'width' => '',
1890 'class' => '',
1891 'id' => '',
1892 ),
1893 'acfe_validate' => '',
1894 'acfe_update' => '',
1895 'acfe_permissions' => '',
1896 'default_value' => '',
1897 'placeholder' => '',
1898 'prepend' => '',
1899 'append' => '',
1900 'maxlength' => '',
1901 ),
1902 array(
1903 'key' => 'field_acfe_dt_search_items',
1904 'label' => 'Search items',
1905 'name' => 'search_items',
1906 'type' => 'text',
1907 'instructions' => '',
1908 'required' => 0,
1909 'conditional_logic' => 0,
1910 'wrapper' => array(
1911 'width' => '',
1912 'class' => '',
1913 'id' => '',
1914 ),
1915 'acfe_validate' => '',
1916 'acfe_update' => '',
1917 'acfe_permissions' => '',
1918 'default_value' => '',
1919 'placeholder' => '',
1920 'prepend' => '',
1921 'append' => '',
1922 'maxlength' => '',
1923 ),
1924 array(
1925 'key' => 'field_acfe_dt_popular_items',
1926 'label' => 'Popular items',
1927 'name' => 'popular_items',
1928 'type' => 'text',
1929 'instructions' => '',
1930 'required' => 0,
1931 'conditional_logic' => 0,
1932 'wrapper' => array(
1933 'width' => '',
1934 'class' => '',
1935 'id' => '',
1936 ),
1937 'acfe_validate' => '',
1938 'acfe_update' => '',
1939 'acfe_permissions' => '',
1940 'default_value' => '',
1941 'placeholder' => '',
1942 'prepend' => '',
1943 'append' => '',
1944 'maxlength' => '',
1945 ),
1946 array(
1947 'key' => 'field_acfe_dt_separate_items_with_commas',
1948 'label' => 'Separate items with commas',
1949 'name' => 'separate_items_with_commas',
1950 'type' => 'text',
1951 'instructions' => '',
1952 'required' => 0,
1953 'conditional_logic' => 0,
1954 'wrapper' => array(
1955 'width' => '',
1956 'class' => '',
1957 'id' => '',
1958 ),
1959 'acfe_validate' => '',
1960 'acfe_update' => '',
1961 'acfe_permissions' => '',
1962 'default_value' => '',
1963 'placeholder' => '',
1964 'prepend' => '',
1965 'append' => '',
1966 'maxlength' => '',
1967 ),
1968 array(
1969 'key' => 'field_acfe_dt_add_or_remove_items',
1970 'label' => 'Add or remove items',
1971 'name' => 'add_or_remove_items',
1972 'type' => 'text',
1973 'instructions' => '',
1974 'required' => 0,
1975 'conditional_logic' => 0,
1976 'wrapper' => array(
1977 'width' => '',
1978 'class' => '',
1979 'id' => '',
1980 ),
1981 'acfe_validate' => '',
1982 'acfe_update' => '',
1983 'acfe_permissions' => '',
1984 'default_value' => '',
1985 'placeholder' => '',
1986 'prepend' => '',
1987 'append' => '',
1988 'maxlength' => '',
1989 ),
1990 array(
1991 'key' => 'field_acfe_dt_choose_from_most_used',
1992 'label' => 'Choose from most used',
1993 'name' => 'choose_from_most_used',
1994 'type' => 'text',
1995 'instructions' => '',
1996 'required' => 0,
1997 'conditional_logic' => 0,
1998 'wrapper' => array(
1999 'width' => '',
2000 'class' => '',
2001 'id' => '',
2002 ),
2003 'acfe_validate' => '',
2004 'acfe_update' => '',
2005 'acfe_permissions' => '',
2006 'default_value' => '',
2007 'placeholder' => '',
2008 'prepend' => '',
2009 'append' => '',
2010 'maxlength' => '',
2011 ),
2012 array(
2013 'key' => 'field_acfe_dt_not_found',
2014 'label' => 'Not found',
2015 'name' => 'not_found',
2016 'type' => 'text',
2017 'instructions' => '',
2018 'required' => 0,
2019 'conditional_logic' => 0,
2020 'wrapper' => array(
2021 'width' => '',
2022 'class' => '',
2023 'id' => '',
2024 ),
2025 'acfe_validate' => '',
2026 'acfe_update' => '',
2027 'acfe_permissions' => '',
2028 'default_value' => '',
2029 'placeholder' => '',
2030 'prepend' => '',
2031 'append' => '',
2032 'maxlength' => '',
2033 ),
2034 array(
2035 'key' => 'field_acfe_dt_back_to_items',
2036 'label' => 'Back to items',
2037 'name' => 'back_to_items',
2038 'type' => 'text',
2039 'instructions' => '',
2040 'required' => 0,
2041 'conditional_logic' => 0,
2042 'wrapper' => array(
2043 'width' => '',
2044 'class' => '',
2045 'id' => '',
2046 ),
2047 'acfe_validate' => '',
2048 'acfe_update' => '',
2049 'acfe_permissions' => '',
2050 'default_value' => '',
2051 'placeholder' => '',
2052 'prepend' => '',
2053 'append' => '',
2054 'maxlength' => '',
2055 ),
2056 ),
2057 ),
2058 array(
2059 'key' => 'field_acfe_dt_tab_capability',
2060 'label' => 'Capability',
2061 'name' => '',
2062 'type' => 'tab',
2063 'instructions' => '',
2064 'required' => 0,
2065 'conditional_logic' => 0,
2066 'wrapper' => array(
2067 'width' => '',
2068 'class' => '',
2069 'id' => '',
2070 ),
2071 'acfe_permissions' => '',
2072 'placement' => 'top',
2073 'endpoint' => 0,
2074 ),
2075 array(
2076 'key' => 'field_acfe_dt_capabilities',
2077 'label' => 'Capabilities',
2078 'name' => 'capabilities',
2079 'type' => 'textarea',
2080 'instructions' => 'An array of the capabilities for this taxonomy:<br /><br />
2081 manage_terms : edit_posts<br />
2082 edit_terms : edit_posts<br />
2083 delete_terms : edit_posts<br />
2084 assign_terms : edit_posts',
2085 'required' => 0,
2086 'conditional_logic' => 0,
2087 'wrapper' => array(
2088 'width' => '',
2089 'class' => '',
2090 'id' => '',
2091 ),
2092 'acfe_validate' => '',
2093 'acfe_update' => '',
2094 'acfe_permissions' => '',
2095 'default_value' => '',
2096 'placeholder' => '',
2097 'maxlength' => '',
2098 'rows' => '',
2099 'new_lines' => '',
2100 ),
2101 array(
2102 'key' => 'field_acfe_dt_tab_rest',
2103 'label' => 'REST',
2104 'name' => '',
2105 'type' => 'tab',
2106 'instructions' => '',
2107 'required' => 0,
2108 'conditional_logic' => 0,
2109 'wrapper' => array(
2110 'width' => '',
2111 'class' => '',
2112 'id' => '',
2113 ),
2114 'acfe_permissions' => '',
2115 'placement' => 'top',
2116 'endpoint' => 0,
2117 ),
2118 array(
2119 'key' => 'field_acfe_dt_show_in_rest',
2120 'label' => 'Show in rest',
2121 'name' => 'show_in_rest',
2122 'type' => 'true_false',
2123 'instructions' => 'Whether to include the taxonomy in the REST API. Set this to true for the taxonomy to be available in the block editor',
2124 'required' => 0,
2125 'conditional_logic' => 0,
2126 'wrapper' => array(
2127 'width' => '',
2128 'class' => '',
2129 'id' => '',
2130 ),
2131 'acfe_validate' => '',
2132 'acfe_update' => '',
2133 'acfe_permissions' => '',
2134 'message' => '',
2135 'default_value' => 0,
2136 'ui' => 1,
2137 'ui_on_text' => '',
2138 'ui_off_text' => '',
2139 ),
2140 array(
2141 'key' => 'field_acfe_dt_rest_base',
2142 'label' => 'Rest base',
2143 'name' => 'rest_base',
2144 'type' => 'text',
2145 'instructions' => 'To change the base url of REST API route',
2146 'required' => 0,
2147 'conditional_logic' => 0,
2148 'wrapper' => array(
2149 'width' => '',
2150 'class' => '',
2151 'id' => '',
2152 ),
2153 'acfe_validate' => '',
2154 'acfe_update' => '',
2155 'acfe_permissions' => '',
2156 'default_value' => '',
2157 'placeholder' => '',
2158 'prepend' => '',
2159 'append' => '',
2160 'maxlength' => '',
2161 ),
2162 array(
2163 'key' => 'field_acfe_dt_rest_controller_class',
2164 'label' => 'Rest controller class',
2165 'name' => 'rest_controller_class',
2166 'type' => 'text',
2167 'instructions' => 'REST API Controller class name',
2168 'required' => 0,
2169 'conditional_logic' => 0,
2170 'wrapper' => array(
2171 'width' => '',
2172 'class' => '',
2173 'id' => '',
2174 ),
2175 'acfe_validate' => '',
2176 'acfe_update' => '',
2177 'acfe_permissions' => '',
2178 'default_value' => 'WP_REST_Terms_Controller',
2179 'placeholder' => '',
2180 'prepend' => '',
2181 'append' => '',
2182 'maxlength' => '',
2183 ),
2184 ),
2185 ));