form
6 years ago
author.php
6 years ago
autosync.php
6 years ago
dev.php
6 years ago
dynamic-block-type.php
6 years ago
dynamic-form.php
6 years ago
dynamic-options-page.php
6 years ago
dynamic-post-type.php
6 years ago
dynamic-taxonomy.php
6 years ago
taxonomy.php
6 years ago
dynamic-options-page.php
805 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')) |
| 4 | exit; |
| 5 | |
| 6 | // Check setting |
| 7 | if(!acf_get_setting('acfe/modules/dynamic_options_pages')) |
| 8 | return; |
| 9 | |
| 10 | /** |
| 11 | * Register Dynamic Options Page |
| 12 | */ |
| 13 | add_action('init', 'acfe_dop_register'); |
| 14 | function acfe_dop_register(){ |
| 15 | |
| 16 | register_post_type('acfe-dop', array( |
| 17 | 'label' => 'Options Page', |
| 18 | 'description' => 'Options Page', |
| 19 | 'labels' => array( |
| 20 | 'name' => 'Options Pages', |
| 21 | 'singular_name' => 'Options Page', |
| 22 | 'menu_name' => 'Options Pages', |
| 23 | 'edit_item' => 'Edit Options Page', |
| 24 | 'add_new_item' => 'New Options Page', |
| 25 | ), |
| 26 | 'supports' => false, |
| 27 | 'hierarchical' => true, |
| 28 | 'public' => false, |
| 29 | 'show_ui' => true, |
| 30 | 'show_in_menu' => false, |
| 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 | )); |
| 51 | |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Dynamic Options Page Menu |
| 56 | */ |
| 57 | add_action('admin_menu', 'acfe_dop_menu'); |
| 58 | function acfe_dop_menu(){ |
| 59 | |
| 60 | if(!acf_get_setting('show_admin')) |
| 61 | return; |
| 62 | |
| 63 | add_submenu_page('edit.php?post_type=acf-field-group', __('Options'), __('Options'), acf_get_setting('capability'), 'edit.php?post_type=acfe-dop'); |
| 64 | |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Dynamic Options Page Menu: Parent Highlight |
| 69 | */ |
| 70 | add_filter('parent_file', 'acfe_dop_menu_parent_highlight'); |
| 71 | function acfe_dop_menu_parent_highlight($parent_file){ |
| 72 | |
| 73 | global $pagenow; |
| 74 | if($pagenow != 'post.php' && $pagenow != 'post-new.php') |
| 75 | return $parent_file; |
| 76 | |
| 77 | $post_type = get_post_type(); |
| 78 | if($post_type != 'acfe-dop') |
| 79 | return $parent_file; |
| 80 | |
| 81 | return 'edit.php?post_type=acf-field-group'; |
| 82 | |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Dynamic Options Page Menu: Submenu Highlight |
| 87 | */ |
| 88 | add_filter('submenu_file', 'acfe_dop_menu_sub_highlight'); |
| 89 | function acfe_dop_menu_sub_highlight($submenu_file){ |
| 90 | |
| 91 | global $pagenow; |
| 92 | if($pagenow != 'post-new.php') |
| 93 | return $submenu_file; |
| 94 | |
| 95 | $post_type = get_post_type(); |
| 96 | if($post_type != 'acfe-dop') |
| 97 | return $submenu_file; |
| 98 | |
| 99 | return 'edit.php?post_type=acfe-dop'; |
| 100 | |
| 101 | } |
| 102 | |
| 103 | |
| 104 | /** |
| 105 | * ACF Register Options Pages |
| 106 | */ |
| 107 | add_action('init', 'acfe_dop_registers'); |
| 108 | function acfe_dop_registers(){ |
| 109 | |
| 110 | $dynamic_options_pages = get_option('acfe_dynamic_options_pages', array()); |
| 111 | if(empty($dynamic_options_pages)) |
| 112 | return; |
| 113 | |
| 114 | $options_sub_pages = array(); |
| 115 | |
| 116 | foreach($dynamic_options_pages as $name => $register_args){ |
| 117 | |
| 118 | // Do not register sub pages |
| 119 | if(isset($register_args['parent_slug']) && !empty($register_args['parent_slug'])){ |
| 120 | |
| 121 | $options_sub_pages[$name] = $register_args; |
| 122 | continue; |
| 123 | |
| 124 | } |
| 125 | |
| 126 | // Register: Execute |
| 127 | acf_add_options_page($register_args); |
| 128 | |
| 129 | } |
| 130 | |
| 131 | // Register sub pages |
| 132 | if(!empty($options_sub_pages)){ |
| 133 | |
| 134 | foreach($options_sub_pages as $name => $register_args){ |
| 135 | |
| 136 | // Register: Execute |
| 137 | acf_add_options_page($register_args); |
| 138 | |
| 139 | } |
| 140 | |
| 141 | } |
| 142 | |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * ACF Exclude Dynamic Options Page from available post types |
| 147 | */ |
| 148 | add_filter('acf/get_post_types', 'acfe_dop_exclude', 10, 2); |
| 149 | function acfe_dop_exclude($post_types, $args){ |
| 150 | |
| 151 | if(empty($post_types)) |
| 152 | return $post_types; |
| 153 | |
| 154 | foreach($post_types as $k => $post_type){ |
| 155 | |
| 156 | if($post_type != 'acfe-dop') |
| 157 | continue; |
| 158 | |
| 159 | unset($post_types[$k]); |
| 160 | |
| 161 | } |
| 162 | |
| 163 | return $post_types; |
| 164 | |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Dynamic Options Page Save |
| 169 | */ |
| 170 | add_action('acf/save_post', 'acfe_dop_filter_save', 20); |
| 171 | function acfe_dop_filter_save($post_id){ |
| 172 | |
| 173 | if(get_post_type($post_id) != 'acfe-dop') |
| 174 | return; |
| 175 | |
| 176 | $title = get_field('page_title', $post_id); |
| 177 | $name = get_field('acfe_dop_name', $post_id); |
| 178 | $parent_slug = get_field('parent_slug', $post_id); |
| 179 | |
| 180 | // Force name |
| 181 | if(empty($name)) |
| 182 | $name = sanitize_title($title); |
| 183 | |
| 184 | $parent = 0; |
| 185 | if(!empty($parent_slug)){ |
| 186 | |
| 187 | $get_dop_parent = get_posts(array( |
| 188 | 'post_type' => 'acfe-dop', |
| 189 | 'posts_per_page' => 1, |
| 190 | 'fields' => 'ids', |
| 191 | 'meta_query' => array( |
| 192 | array( |
| 193 | 'key' => 'menu_slug', |
| 194 | 'value' => $parent_slug |
| 195 | ) |
| 196 | ) |
| 197 | )); |
| 198 | |
| 199 | if(!empty($get_dop_parent)) |
| 200 | $parent = $get_dop_parent[0]; |
| 201 | |
| 202 | } |
| 203 | |
| 204 | // Update post |
| 205 | wp_update_post(array( |
| 206 | 'ID' => $post_id, |
| 207 | 'post_title' => $title, |
| 208 | 'post_name' => $name, |
| 209 | 'post_parent' => $parent, |
| 210 | )); |
| 211 | |
| 212 | // Register Args |
| 213 | $page_title = get_field('page_title', $post_id); |
| 214 | $menu_title = get_field('menu_title', $post_id); |
| 215 | $menu_slug = get_field('menu_slug', $post_id); |
| 216 | $capability = get_field('capability', $post_id); |
| 217 | $position = get_field('position', $post_id); |
| 218 | $icon_url = get_field('icon_url', $post_id); |
| 219 | $redirect = get_field('redirect', $post_id); |
| 220 | $p_id = get_field('post_id', $post_id); |
| 221 | $autoload = get_field('autoload', $post_id); |
| 222 | $update_button = get_field('update_button', $post_id); |
| 223 | $updated_message = get_field('updated_message', $post_id); |
| 224 | |
| 225 | // Register: Args |
| 226 | $register_args = array( |
| 227 | 'page_title' => $page_title, |
| 228 | 'menu_title' => $menu_title, |
| 229 | 'menu_slug' => $menu_slug, |
| 230 | 'capability' => $capability, |
| 231 | 'position' => $position, |
| 232 | 'parent_slug' => $parent_slug, |
| 233 | 'icon_url' => $icon_url, |
| 234 | 'redirect' => $redirect, |
| 235 | 'post_id' => $p_id, |
| 236 | 'autoload' => $autoload, |
| 237 | 'update_button' => $update_button, |
| 238 | 'updated_message' => $updated_message, |
| 239 | ); |
| 240 | |
| 241 | // Menu title |
| 242 | if(empty($menu_title)) |
| 243 | $register_args['menu_title'] = $page_title; |
| 244 | |
| 245 | // Menu slug |
| 246 | if(empty($menu_slug)) |
| 247 | $register_args['menu_slug'] = sanitize_title($register_args['menu_title']); |
| 248 | |
| 249 | // Redirect |
| 250 | $register_args['redirect'] = true; |
| 251 | if(empty($redirect)) |
| 252 | $register_args['redirect'] = false; |
| 253 | |
| 254 | // Post ID |
| 255 | if(empty($p_id)) |
| 256 | $register_args['post_id'] = 'options'; |
| 257 | |
| 258 | // Autoload |
| 259 | $register_args['autoload'] = true; |
| 260 | if(empty($autoload)) |
| 261 | $register_args['autoload'] = false; |
| 262 | |
| 263 | // Get ACFE option |
| 264 | $option = get_option('acfe_dynamic_options_pages', array()); |
| 265 | |
| 266 | // Create ACFE option |
| 267 | $option[$name] = $register_args; |
| 268 | |
| 269 | // Sort keys ASC |
| 270 | ksort($option); |
| 271 | |
| 272 | // Update ACFE option |
| 273 | update_option('acfe_dynamic_options_pages', $option); |
| 274 | |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * Dynamic Options Page Status Publish > Trash |
| 279 | */ |
| 280 | add_action('publish_to_trash', 'acfe_dop_filter_status_trash'); |
| 281 | function acfe_dop_filter_status_trash($post){ |
| 282 | |
| 283 | if(get_post_type($post->ID) != 'acfe-dop') |
| 284 | return; |
| 285 | |
| 286 | $post_id = $post->ID; |
| 287 | $title = get_field('page_title', $post_id); |
| 288 | $name = get_field('acfe_dop_name', $post_id); |
| 289 | |
| 290 | // Get ACFE option |
| 291 | $option = get_option('acfe_dynamic_options_pages', array()); |
| 292 | |
| 293 | // Check ACFE option |
| 294 | if(isset($option[$name])) |
| 295 | unset($option[$name]); |
| 296 | |
| 297 | // Update ACFE option |
| 298 | update_option('acfe_dynamic_options_pages', $option); |
| 299 | |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Dynamic Options Page Status Trash > Publish |
| 304 | */ |
| 305 | add_action('trash_to_publish', 'acfe_dop_filter_status_publish'); |
| 306 | function acfe_dop_filter_status_publish($post){ |
| 307 | |
| 308 | if(get_post_type($post->ID) != 'acfe-dop') |
| 309 | return; |
| 310 | |
| 311 | acfe_dop_filter_save($post->ID); |
| 312 | |
| 313 | } |
| 314 | |
| 315 | /** |
| 316 | * Dynamic Options Page Admin: List |
| 317 | */ |
| 318 | add_action('pre_get_posts', 'acfe_dop_admin_pre_get_posts'); |
| 319 | function acfe_dop_admin_pre_get_posts($query){ |
| 320 | |
| 321 | if(!is_admin() || !$query->is_main_query()) |
| 322 | return; |
| 323 | |
| 324 | global $pagenow; |
| 325 | if($pagenow != 'edit.php') |
| 326 | return; |
| 327 | |
| 328 | $post_type = $query->get('post_type'); |
| 329 | if($post_type != 'acfe-dop') |
| 330 | return; |
| 331 | |
| 332 | $query->set('orderby', 'name'); |
| 333 | $query->set('order', 'ASC'); |
| 334 | |
| 335 | } |
| 336 | |
| 337 | /** |
| 338 | * Dynamic Options Page Admin: Posts Per Page |
| 339 | */ |
| 340 | add_filter('edit_posts_per_page', 'acfe_dop_admin_ppp', 10, 2); |
| 341 | function acfe_dop_admin_ppp($ppp, $post_type){ |
| 342 | |
| 343 | if($post_type != 'acfe-dop') |
| 344 | return $ppp; |
| 345 | |
| 346 | global $pagenow; |
| 347 | if($pagenow != 'edit.php') |
| 348 | return $ppp; |
| 349 | |
| 350 | return 999; |
| 351 | |
| 352 | } |
| 353 | |
| 354 | /** |
| 355 | * Admin List Columns |
| 356 | */ |
| 357 | add_filter('manage_edit-acfe-dop_columns', 'acfe_dop_admin_columns'); |
| 358 | function acfe_dop_admin_columns($columns){ |
| 359 | |
| 360 | if(isset($columns['date'])) |
| 361 | unset($columns['date']); |
| 362 | |
| 363 | $columns['name'] = __('Name'); |
| 364 | $columns['post_id'] = __('Post ID'); |
| 365 | $columns['autoload'] = __('Autoload'); |
| 366 | |
| 367 | return $columns; |
| 368 | |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * Admin List Columns HTML |
| 373 | */ |
| 374 | add_action('manage_acfe-dop_posts_custom_column', 'acfe_dop_admin_columns_html', 10, 2); |
| 375 | function acfe_dop_admin_columns_html($column, $post_id){ |
| 376 | |
| 377 | // Name |
| 378 | if($column === 'name'){ |
| 379 | |
| 380 | $name = get_field('acfe_dop_name', $post_id); |
| 381 | |
| 382 | echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . $name . '</code>'; |
| 383 | |
| 384 | } |
| 385 | |
| 386 | // Post ID |
| 387 | elseif($column === 'post_id'){ |
| 388 | |
| 389 | $p_id = get_field('post_id', $post_id); |
| 390 | if(empty($p_id)) |
| 391 | $p_id = 'options'; |
| 392 | |
| 393 | echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . $p_id. '</code>'; |
| 394 | |
| 395 | } |
| 396 | |
| 397 | // Autoload |
| 398 | elseif($column === 'autoload'){ |
| 399 | |
| 400 | $autoload = get_field('autoload', $post_id); |
| 401 | |
| 402 | if(empty($autoload)) |
| 403 | echo 'No'; |
| 404 | else |
| 405 | echo 'Yes'; |
| 406 | |
| 407 | } |
| 408 | |
| 409 | } |
| 410 | |
| 411 | /** |
| 412 | * Admin List Row Actions |
| 413 | */ |
| 414 | add_filter('page_row_actions','acfe_dop_admin_row', 10, 2); |
| 415 | function acfe_dop_admin_row($actions, $post){ |
| 416 | |
| 417 | if($post->post_type != 'acfe-dop' || $post->post_status != 'publish') |
| 418 | return $actions; |
| 419 | |
| 420 | $name = get_field('acfe_dop_name', $post->ID); |
| 421 | |
| 422 | $actions['acfe_dpt_export_json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dop_export&keys=' . $name) . '">' . __('Json') . '</a>'; |
| 423 | |
| 424 | return $actions; |
| 425 | |
| 426 | } |
| 427 | |
| 428 | /** |
| 429 | * Admin Disable Name |
| 430 | */ |
| 431 | add_filter('acf/prepare_field/name=acfe_dop_name', 'acfe_dop_admin_disable_name'); |
| 432 | function acfe_dop_admin_disable_name($field){ |
| 433 | |
| 434 | global $pagenow; |
| 435 | if($pagenow != 'post.php') |
| 436 | return $field; |
| 437 | |
| 438 | $field['disabled'] = true; |
| 439 | |
| 440 | return $field; |
| 441 | |
| 442 | } |
| 443 | |
| 444 | /** |
| 445 | * Admin Force Name |
| 446 | */ |
| 447 | add_action('load-edit.php', 'acfe_dop_admin_name_value'); |
| 448 | function acfe_dop_admin_name_value(){ |
| 449 | |
| 450 | // Get post type |
| 451 | global $typenow; |
| 452 | |
| 453 | // Check post type |
| 454 | $post_type = $typenow; |
| 455 | if(empty($post_type) || $post_type != 'acfe-dop') |
| 456 | return; |
| 457 | |
| 458 | $get_options = get_posts(array( |
| 459 | 'post_type' => 'acfe-dop', |
| 460 | 'posts_per_page' => -1, |
| 461 | 'fields' => 'ids' |
| 462 | )); |
| 463 | |
| 464 | if(empty($get_options)) |
| 465 | return; |
| 466 | |
| 467 | foreach($get_options as $post_id){ |
| 468 | |
| 469 | if(get_field('acfe_dop_name', $post_id)) |
| 470 | continue; |
| 471 | |
| 472 | update_field('acfe_dop_name', sanitize_title(get_field('page_title', $post_id)), $post_id); |
| 473 | |
| 474 | } |
| 475 | |
| 476 | } |
| 477 | |
| 478 | /** |
| 479 | * Add Local Field Group |
| 480 | */ |
| 481 | acf_add_local_field_group(array( |
| 482 | 'key' => 'group_acfe_dynamic_options_page', |
| 483 | 'title' => __('Dynamic Options Page', 'acfe'), |
| 484 | |
| 485 | 'location' => array( |
| 486 | array( |
| 487 | array( |
| 488 | 'param' => 'post_type', |
| 489 | 'operator' => '==', |
| 490 | 'value' => 'acfe-dop', |
| 491 | ), |
| 492 | ), |
| 493 | ), |
| 494 | |
| 495 | 'menu_order' => 0, |
| 496 | 'position' => 'normal', |
| 497 | 'style' => 'default', |
| 498 | 'label_placement' => 'left', |
| 499 | 'instruction_placement' => 'label', |
| 500 | 'hide_on_screen' => '', |
| 501 | 'active' => 1, |
| 502 | 'description' => '', |
| 503 | |
| 504 | 'fields' => array( |
| 505 | array( |
| 506 | 'key' => 'field_acfe_dop_page_title', |
| 507 | 'label' => 'Page title', |
| 508 | 'name' => 'page_title', |
| 509 | 'type' => 'text', |
| 510 | 'instructions' => '(string) The title displayed on the options page. Required.', |
| 511 | 'required' => 1, |
| 512 | 'conditional_logic' => 0, |
| 513 | 'wrapper' => array( |
| 514 | 'width' => '', |
| 515 | 'class' => '', |
| 516 | 'id' => '', |
| 517 | ), |
| 518 | 'acfe_validate' => '', |
| 519 | 'acfe_update' => '', |
| 520 | 'acfe_permissions' => '', |
| 521 | 'default_value' => '', |
| 522 | 'placeholder' => '', |
| 523 | 'prepend' => '', |
| 524 | 'append' => '', |
| 525 | 'maxlength' => '', |
| 526 | ), |
| 527 | array( |
| 528 | 'key' => 'field_acfe_dop_name', |
| 529 | 'label' => 'Name', |
| 530 | 'name' => 'acfe_dop_name', |
| 531 | 'type' => 'acfe_slug', |
| 532 | 'instructions' => '(string) Options page slug. Must be unique', |
| 533 | 'required' => 1, |
| 534 | 'conditional_logic' => 0, |
| 535 | 'wrapper' => array( |
| 536 | 'width' => '', |
| 537 | 'class' => '', |
| 538 | 'id' => '', |
| 539 | ), |
| 540 | 'acfe_validate' => '', |
| 541 | 'acfe_update' => '', |
| 542 | 'acfe_permissions' => '', |
| 543 | 'default_value' => '', |
| 544 | 'placeholder' => '', |
| 545 | 'prepend' => '', |
| 546 | 'append' => '', |
| 547 | 'maxlength' => '', |
| 548 | ), |
| 549 | array( |
| 550 | 'key' => 'field_acfe_dop_menu_title', |
| 551 | 'label' => 'Menu title', |
| 552 | 'name' => 'menu_title', |
| 553 | 'type' => 'text', |
| 554 | 'instructions' => '(string) The title displayed in the wp-admin sidebar. Defaults to page_title', |
| 555 | 'required' => 0, |
| 556 | 'conditional_logic' => 0, |
| 557 | 'wrapper' => array( |
| 558 | 'width' => '', |
| 559 | 'class' => '', |
| 560 | 'id' => '', |
| 561 | ), |
| 562 | 'acfe_validate' => '', |
| 563 | 'acfe_update' => '', |
| 564 | 'acfe_permissions' => '', |
| 565 | 'default_value' => '', |
| 566 | 'placeholder' => '', |
| 567 | 'prepend' => '', |
| 568 | 'append' => '', |
| 569 | 'maxlength' => '', |
| 570 | ), |
| 571 | array( |
| 572 | 'key' => 'field_acfe_dop_menu_slug', |
| 573 | 'label' => 'Menu slug', |
| 574 | 'name' => 'menu_slug', |
| 575 | 'type' => 'acfe_slug', |
| 576 | 'instructions' => '(string) The URL slug used to uniquely identify this options page. Defaults to a url friendly version of menu_title', |
| 577 | 'required' => 0, |
| 578 | 'conditional_logic' => 0, |
| 579 | 'wrapper' => array( |
| 580 | 'width' => '', |
| 581 | 'class' => '', |
| 582 | 'id' => '', |
| 583 | ), |
| 584 | 'acfe_validate' => '', |
| 585 | 'acfe_update' => array( |
| 586 | '5cd2a4d60fbf2' => array( |
| 587 | 'acfe_update_function' => 'sanitize_title', |
| 588 | ), |
| 589 | ), |
| 590 | 'acfe_permissions' => '', |
| 591 | 'default_value' => '', |
| 592 | 'placeholder' => '', |
| 593 | 'prepend' => '', |
| 594 | 'append' => '', |
| 595 | 'maxlength' => '', |
| 596 | ), |
| 597 | array( |
| 598 | 'key' => 'field_acfe_dop_capability', |
| 599 | 'label' => 'Capability', |
| 600 | 'name' => 'capability', |
| 601 | 'type' => 'text', |
| 602 | 'instructions' => '(string) The capability required for this menu to be displayed to the user. Defaults to edit_posts.<br /><br /> |
| 603 | |
| 604 | Read more about capability here: <a href="https://codex.wordpress.org/Roles_and_Capabilities">https://codex.wordpress.org/Roles_and_Capabilities</a>', |
| 605 | 'required' => 0, |
| 606 | 'conditional_logic' => 0, |
| 607 | 'wrapper' => array( |
| 608 | 'width' => '', |
| 609 | 'class' => '', |
| 610 | 'id' => '', |
| 611 | ), |
| 612 | 'acfe_validate' => '', |
| 613 | 'acfe_update' => '', |
| 614 | 'acfe_permissions' => '', |
| 615 | 'default_value' => 'edit_posts', |
| 616 | 'placeholder' => '', |
| 617 | 'prepend' => '', |
| 618 | 'append' => '', |
| 619 | 'maxlength' => '', |
| 620 | ), |
| 621 | array( |
| 622 | 'key' => 'field_acfe_dop_position', |
| 623 | 'label' => 'Position', |
| 624 | 'name' => 'position', |
| 625 | 'type' => 'text', |
| 626 | 'instructions' => '(int|string) The position in the menu order this menu should appear. Defaults to bottom of utility menu items.<br /><br /> |
| 627 | |
| 628 | WARNING: if two menu items use the same position attribute, one of the items may be overwritten so that only one item displays!<br /> |
| 629 | Risk of conflict can be reduced by using decimal instead of integer values, e.g. \'63.3\' instead of 63 (must use quotes).', |
| 630 | 'required' => 0, |
| 631 | 'conditional_logic' => 0, |
| 632 | 'wrapper' => array( |
| 633 | 'width' => '', |
| 634 | 'class' => '', |
| 635 | 'id' => '', |
| 636 | ), |
| 637 | 'acfe_validate' => '', |
| 638 | 'acfe_update' => '', |
| 639 | 'acfe_permissions' => '', |
| 640 | 'default_value' => '', |
| 641 | 'placeholder' => '', |
| 642 | 'prepend' => '', |
| 643 | 'append' => '', |
| 644 | 'maxlength' => '', |
| 645 | ), |
| 646 | array( |
| 647 | 'key' => 'field_acfe_dop_parent_slug', |
| 648 | 'label' => 'Parent slug', |
| 649 | 'name' => 'parent_slug', |
| 650 | 'type' => 'text', |
| 651 | 'instructions' => '(string) The slug of another WP admin page. if set, this will become a child page.', |
| 652 | 'required' => 0, |
| 653 | 'conditional_logic' => 0, |
| 654 | 'wrapper' => array( |
| 655 | 'width' => '', |
| 656 | 'class' => '', |
| 657 | 'id' => '', |
| 658 | ), |
| 659 | 'acfe_validate' => '', |
| 660 | 'acfe_update' => '', |
| 661 | 'acfe_permissions' => '', |
| 662 | 'default_value' => '', |
| 663 | 'placeholder' => '', |
| 664 | 'prepend' => '', |
| 665 | 'append' => '', |
| 666 | 'maxlength' => '', |
| 667 | ), |
| 668 | array( |
| 669 | 'key' => 'field_acfe_dop_icon_url', |
| 670 | 'label' => 'Icon url', |
| 671 | 'name' => 'icon_url', |
| 672 | 'type' => 'text', |
| 673 | 'instructions' => '(string) The icon class for this menu. Defaults to default WordPress gear.<br /><br /> |
| 674 | Read more about dashicons here: <a href="https://developer.wordpress.org/resource/dashicons/">https://developer.wordpress.org/resource/dashicons/</a>', |
| 675 | 'required' => 0, |
| 676 | 'conditional_logic' => 0, |
| 677 | 'wrapper' => array( |
| 678 | 'width' => '', |
| 679 | 'class' => '', |
| 680 | 'id' => '', |
| 681 | ), |
| 682 | 'acfe_validate' => '', |
| 683 | 'acfe_update' => '', |
| 684 | 'acfe_permissions' => '', |
| 685 | 'default_value' => '', |
| 686 | 'placeholder' => '', |
| 687 | 'prepend' => '', |
| 688 | 'append' => '', |
| 689 | 'maxlength' => '', |
| 690 | ), |
| 691 | array( |
| 692 | 'key' => 'field_acfe_dop_redirect', |
| 693 | 'label' => 'Redirect', |
| 694 | 'name' => 'redirect', |
| 695 | 'type' => 'true_false', |
| 696 | 'instructions' => '(boolean) If set to true, this options page will redirect to the first child page (if a child page exists). |
| 697 | If set to false, this parent page will appear alongside any child pages. Defaults to true', |
| 698 | 'required' => 0, |
| 699 | 'conditional_logic' => 0, |
| 700 | 'wrapper' => array( |
| 701 | 'width' => '', |
| 702 | 'class' => '', |
| 703 | 'id' => '', |
| 704 | ), |
| 705 | 'acfe_validate' => '', |
| 706 | 'acfe_update' => '', |
| 707 | 'acfe_permissions' => '', |
| 708 | 'message' => '', |
| 709 | 'default_value' => 1, |
| 710 | 'ui' => 1, |
| 711 | 'ui_on_text' => 'True', |
| 712 | 'ui_off_text' => 'False', |
| 713 | ), |
| 714 | array( |
| 715 | 'key' => 'field_acfe_dop_post_id', |
| 716 | 'label' => 'Post ID', |
| 717 | 'name' => 'post_id', |
| 718 | 'type' => 'text', |
| 719 | 'instructions' => '(int|string) The \'$post_id\' to save/load data to/from. Can be set to a numeric post ID (123), or a string (\'user_2\'). |
| 720 | Defaults to \'options\'.', |
| 721 | 'required' => 0, |
| 722 | 'conditional_logic' => 0, |
| 723 | 'wrapper' => array( |
| 724 | 'width' => '', |
| 725 | 'class' => '', |
| 726 | 'id' => '', |
| 727 | ), |
| 728 | 'acfe_validate' => '', |
| 729 | 'acfe_update' => '', |
| 730 | 'acfe_permissions' => '', |
| 731 | 'default_value' => 'options', |
| 732 | 'placeholder' => '', |
| 733 | 'prepend' => '', |
| 734 | 'append' => '', |
| 735 | 'maxlength' => '', |
| 736 | ), |
| 737 | array( |
| 738 | 'key' => 'field_acfe_dop_autoload', |
| 739 | 'label' => 'Autoload', |
| 740 | 'name' => 'autoload', |
| 741 | 'type' => 'true_false', |
| 742 | 'instructions' => '(boolean) Whether to load the option (values saved from this options page) when WordPress starts up. |
| 743 | Defaults to false.', |
| 744 | 'required' => 0, |
| 745 | 'conditional_logic' => 0, |
| 746 | 'wrapper' => array( |
| 747 | 'width' => '', |
| 748 | 'class' => '', |
| 749 | 'id' => '', |
| 750 | ), |
| 751 | 'acfe_validate' => '', |
| 752 | 'acfe_update' => '', |
| 753 | 'acfe_permissions' => '', |
| 754 | 'message' => '', |
| 755 | 'default_value' => 0, |
| 756 | 'ui' => 1, |
| 757 | 'ui_on_text' => 'True', |
| 758 | 'ui_off_text' => 'False', |
| 759 | ), |
| 760 | array( |
| 761 | 'key' => 'field_acfe_dop_update_button', |
| 762 | 'label' => 'Update button', |
| 763 | 'name' => 'update_button', |
| 764 | 'type' => 'text', |
| 765 | 'instructions' => '(string) The update button text.', |
| 766 | 'required' => 0, |
| 767 | 'conditional_logic' => 0, |
| 768 | 'wrapper' => array( |
| 769 | 'width' => '', |
| 770 | 'class' => '', |
| 771 | 'id' => '', |
| 772 | ), |
| 773 | 'acfe_validate' => '', |
| 774 | 'acfe_update' => '', |
| 775 | 'acfe_permissions' => '', |
| 776 | 'default_value' => 'Update', |
| 777 | 'placeholder' => '', |
| 778 | 'prepend' => '', |
| 779 | 'append' => '', |
| 780 | 'maxlength' => '', |
| 781 | ), |
| 782 | array( |
| 783 | 'key' => 'field_acfe_dop_updated_message', |
| 784 | 'label' => 'Updated Message', |
| 785 | 'name' => 'updated_message', |
| 786 | 'type' => 'text', |
| 787 | 'instructions' => '(string) The message shown above the form on submit.', |
| 788 | 'required' => 0, |
| 789 | 'conditional_logic' => 0, |
| 790 | 'wrapper' => array( |
| 791 | 'width' => '', |
| 792 | 'class' => '', |
| 793 | 'id' => '', |
| 794 | ), |
| 795 | 'acfe_validate' => '', |
| 796 | 'acfe_update' => '', |
| 797 | 'acfe_permissions' => '', |
| 798 | 'default_value' => 'Options Updated', |
| 799 | 'placeholder' => '', |
| 800 | 'prepend' => '', |
| 801 | 'append' => '', |
| 802 | 'maxlength' => '', |
| 803 | ), |
| 804 | ), |
| 805 | )); |