PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.4.0-beta2
Secure Custom Fields v6.4.0-beta2
6.9.5 6.9.4 6.9.3 6.9.2 6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / pro / locations / class-acf-location-options-page.php
secure-custom-fields / pro / locations Last commit date
class-acf-location-block.php 1 year ago class-acf-location-options-page.php 1 year ago index.php 1 year ago
class-acf-location-options-page.php
85 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 if ( ! class_exists( 'ACF_Location_Options_Page' ) ) :
8
9 class ACF_Location_Options_Page extends ACF_Location {
10
11 /**
12 * Initializes props.
13 *
14 * @date 5/03/2014
15 * @since 5.0.0
16 *
17 * @param void
18 * @return void
19 */
20 public function initialize() {
21 $this->name = 'options_page';
22 $this->label = __( 'Options Page', 'acf' );
23 $this->category = 'forms';
24 $this->object_type = 'option';
25 }
26
27 /**
28 * Matches the provided rule against the screen args returning a bool result.
29 *
30 * @date 9/4/20
31 * @since 5.9.0
32 *
33 * @param array $rule The location rule.
34 * @param array $screen The screen args.
35 * @param array $field_group The field group settings.
36 * @return boolean
37 */
38 public function match( $rule, $screen, $field_group ) {
39
40 // Check screen args.
41 if ( isset( $screen['options_page'] ) ) {
42 $options_page = $screen['options_page'];
43 } else {
44 return false;
45 }
46
47 // Compare rule against $nav_menu.
48 return $this->compare_to_rule( $options_page, $rule );
49 }
50
51 /**
52 * Returns an array of possible values for this rule type.
53 *
54 * @date 9/4/20
55 * @since 5.9.0
56 *
57 * @param array $rule A location rule.
58 * @return array
59 */
60 public function get_values( $rule ) {
61 $choices = array();
62
63 // Append pages.
64 $pages = acf_get_options_pages();
65 if ( $pages ) {
66 foreach ( $pages as $page ) {
67 $choices[ $page['menu_slug'] ] = $page['page_title'];
68 }
69 } else {
70 $choices[''] = __( 'Select options page...', 'acf' );
71 }
72
73 if ( acf_get_setting( 'enable_options_pages_ui' ) ) {
74 $choices['add_new_options_page'] = __( 'Add New Options Page', 'acf' );
75 }
76
77 // Return choices.
78 return $choices;
79 }
80 }
81
82 // initialize
83 acf_register_location_type( 'ACF_Location_Options_Page' );
84 endif; // class_exists check
85