abstract-acf-legacy-location.php
1 year ago
abstract-acf-location.php
2 weeks ago
class-acf-location-attachment.php
2 weeks ago
class-acf-location-block.php
1 year ago
class-acf-location-comment.php
1 year ago
class-acf-location-current-user-role.php
2 weeks ago
class-acf-location-current-user.php
2 weeks ago
class-acf-location-nav-menu-item.php
1 year ago
class-acf-location-nav-menu.php
2 weeks ago
class-acf-location-options-page.php
1 year ago
class-acf-location-page-parent.php
1 year ago
class-acf-location-page-template.php
2 weeks ago
class-acf-location-page-type.php
2 weeks ago
class-acf-location-page.php
1 year ago
class-acf-location-post-category.php
1 year ago
class-acf-location-post-format.php
1 year ago
class-acf-location-post-status.php
1 year ago
class-acf-location-post-taxonomy.php
2 weeks ago
class-acf-location-post-template.php
2 weeks ago
class-acf-location-post-type.php
2 weeks ago
class-acf-location-post.php
1 year ago
class-acf-location-taxonomy.php
2 weeks ago
class-acf-location-user-form.php
2 weeks ago
class-acf-location-user-role.php
2 weeks ago
class-acf-location-widget.php
1 year ago
index.php
1 year ago
class-acf-location-options-page.php
92 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Handles adding Options Page to the menu. |
| 4 | * |
| 5 | * @package wordpress/secure-custom-fields |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; // Exit if accessed directly |
| 10 | } |
| 11 | |
| 12 | if ( ! class_exists( 'ACF_Location_Options_Page' ) ) : |
| 13 | |
| 14 | /** |
| 15 | * Handles adding Options Page to the menu. |
| 16 | */ |
| 17 | class ACF_Location_Options_Page extends ACF_Location { |
| 18 | |
| 19 | /** |
| 20 | * Initializes props. |
| 21 | * |
| 22 | * @date 5/03/2014 |
| 23 | * @since ACF 5.0.0 |
| 24 | * |
| 25 | * @return void |
| 26 | */ |
| 27 | public function initialize() { |
| 28 | $this->name = 'options_page'; |
| 29 | $this->label = __( 'Options Page', 'secure-custom-fields' ); |
| 30 | $this->category = 'forms'; |
| 31 | $this->object_type = 'option'; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Matches the provided rule against the screen args returning a bool result. |
| 36 | * |
| 37 | * @date 9/4/20 |
| 38 | * @since ACF 5.9.0 |
| 39 | * |
| 40 | * @param array $rule The location rule. |
| 41 | * @param array $screen The screen args. |
| 42 | * @param array $field_group The field group settings. |
| 43 | * @return boolean |
| 44 | */ |
| 45 | public function match( $rule, $screen, $field_group ) { |
| 46 | |
| 47 | // Check screen args. |
| 48 | if ( isset( $screen['options_page'] ) ) { |
| 49 | $options_page = $screen['options_page']; |
| 50 | } else { |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | // Compare rule against $nav_menu. |
| 55 | return $this->compare_to_rule( $options_page, $rule ); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Returns an array of possible values for this rule type. |
| 60 | * |
| 61 | * @date 9/4/20 |
| 62 | * @since ACF 5.9.0 |
| 63 | * |
| 64 | * @param array $rule A location rule. |
| 65 | * @return array |
| 66 | */ |
| 67 | public function get_values( $rule ) { |
| 68 | $choices = array(); |
| 69 | |
| 70 | // Append pages. |
| 71 | $pages = acf_get_options_pages(); |
| 72 | if ( $pages ) { |
| 73 | foreach ( $pages as $page ) { |
| 74 | $choices[ $page['menu_slug'] ] = $page['page_title']; |
| 75 | } |
| 76 | } else { |
| 77 | $choices[''] = __( 'Select options page...', 'secure-custom-fields' ); |
| 78 | } |
| 79 | |
| 80 | if ( acf_get_setting( 'enable_options_pages_ui' ) ) { |
| 81 | $choices['add_new_options_page'] = __( 'Add New Options Page', 'secure-custom-fields' ); |
| 82 | } |
| 83 | |
| 84 | // Return choices. |
| 85 | return $choices; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | // initialize |
| 90 | acf_register_location_type( 'ACF_Location_Options_Page' ); |
| 91 | endif; // class_exists check |
| 92 |