advanced-settings.php
1 year ago
basic-settings.php
1 year ago
create-options-page-modal.php
1 year ago
list-empty.php
1 year ago
basic-settings.php
97 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Basic Settings for Options Pages |
| 4 | * |
| 5 | * Renders the basic settings form for options page configuration. |
| 6 | * |
| 7 | * @package wordpress/secure-custom-fields |
| 8 | */ |
| 9 | |
| 10 | global $acf_ui_options_page, $acf_parent_page_options; |
| 11 | |
| 12 | $acf_duplicate_options_page = acf_get_ui_options_page_from_request_args( 'acfduplicate' ); |
| 13 | |
| 14 | if ( acf_is_ui_options_page( $acf_duplicate_options_page ) ) { |
| 15 | // Reset vars that likely have to be changed. |
| 16 | $acf_duplicate_options_page['key'] = uniqid( 'ui_options_page_' ); |
| 17 | $acf_duplicate_options_page['title'] = ''; |
| 18 | $acf_duplicate_options_page['page_title'] = ''; |
| 19 | $acf_duplicate_options_page['menu_title'] = ''; |
| 20 | $acf_duplicate_options_page['menu_slug'] = ''; |
| 21 | |
| 22 | // Rest of the vars can be reused. |
| 23 | $acf_ui_options_page = $acf_duplicate_options_page; |
| 24 | } |
| 25 | |
| 26 | acf_render_field_wrap( |
| 27 | array( |
| 28 | 'label' => __( 'Page Title', 'secure-custom-fields' ), |
| 29 | /* translators: example options page name */ |
| 30 | 'placeholder' => __( 'Site Settings', 'secure-custom-fields' ), |
| 31 | 'type' => 'text', |
| 32 | 'name' => 'page_title', |
| 33 | 'key' => 'page_title', |
| 34 | 'class' => 'acf_options_page_title acf_slugify_to_key', |
| 35 | 'prefix' => 'acf_ui_options_page', |
| 36 | 'value' => $acf_ui_options_page['page_title'], |
| 37 | 'required' => true, |
| 38 | ), |
| 39 | 'div', |
| 40 | 'field' |
| 41 | ); |
| 42 | |
| 43 | acf_render_field_wrap( |
| 44 | array( |
| 45 | 'label' => __( 'Menu Slug', 'secure-custom-fields' ), |
| 46 | 'type' => 'text', |
| 47 | 'name' => 'menu_slug', |
| 48 | 'key' => 'menu_slug', |
| 49 | 'class' => 'acf-options-page-menu_slug acf_slugified_key', |
| 50 | 'prefix' => 'acf_ui_options_page', |
| 51 | 'value' => $acf_ui_options_page['menu_slug'], |
| 52 | 'required' => true, |
| 53 | ), |
| 54 | 'div', |
| 55 | 'field' |
| 56 | ); |
| 57 | |
| 58 | acf_render_field_wrap( |
| 59 | array( |
| 60 | 'label' => __( 'Parent Page', 'secure-custom-fields' ), |
| 61 | 'type' => 'select', |
| 62 | 'name' => 'parent_slug', |
| 63 | 'key' => 'parent_slug', |
| 64 | 'class' => 'acf-options-page-parent_slug', |
| 65 | 'prefix' => 'acf_ui_options_page', |
| 66 | 'value' => $acf_ui_options_page['parent_slug'], |
| 67 | 'choices' => $acf_parent_page_options, |
| 68 | 'required' => true, |
| 69 | ), |
| 70 | 'div', |
| 71 | 'field' |
| 72 | ); |
| 73 | |
| 74 | do_action( 'acf/post_type/basic_settings', $acf_ui_options_page ); |
| 75 | |
| 76 | acf_render_field_wrap( array( 'type' => 'seperator' ) ); |
| 77 | |
| 78 | acf_render_field_wrap( |
| 79 | array( |
| 80 | 'label' => __( 'Advanced Configuration', 'secure-custom-fields' ), |
| 81 | 'instructions' => __( 'I know what I\'m doing, show me all the options.', 'secure-custom-fields' ), |
| 82 | 'type' => 'true_false', |
| 83 | 'name' => 'advanced_configuration', |
| 84 | 'key' => 'advanced_configuration', |
| 85 | 'prefix' => 'acf_ui_options_page', |
| 86 | 'value' => $acf_ui_options_page['advanced_configuration'], |
| 87 | 'ui' => 1, |
| 88 | 'class' => 'acf-advanced-settings-toggle', |
| 89 | ) |
| 90 | ); |
| 91 | |
| 92 | ?> |
| 93 | <div class="acf-hidden"> |
| 94 | <input type="hidden" name="acf_ui_options_page[key]" value="<?php echo esc_attr( $acf_ui_options_page['key'] ); ?>" /> |
| 95 | </div> |
| 96 | <?php |
| 97 |