增强套件,可改进"高级自定义字段"管理
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2462 lines
92 KiB

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