12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- if ( ! defined( 'ABSPATH' ) ) {
- exit;
- }
- if ( ! class_exists( 'ACF_Location_User_Form' ) ) :
- class ACF_Location_User_Form extends ACF_Location {
-
- public function initialize() {
- $this->name = 'user_form';
- $this->label = __( 'User Form', 'acf' );
- $this->category = 'user';
- $this->object_type = 'user';
- }
-
- public function match( $rule, $screen, $field_group ) {
-
- if ( ! empty( $screen['rest'] ) ) {
- return true;
- }
-
- if ( isset( $screen['user_form'] ) ) {
- $user_form = $screen['user_form'];
- } else {
- return false;
- }
-
- if ( $rule['value'] === 'edit' && $user_form === 'add' ) {
- $user_form = 'edit';
- }
-
- return $this->compare_to_rule( $user_form, $rule );
- }
-
- public function get_values( $rule ) {
- return array(
- 'all' => __( 'All', 'acf' ),
- 'add' => __( 'Add', 'acf' ),
- 'edit' => __( 'Add / Edit', 'acf' ),
- 'register' => __( 'Register', 'acf' ),
- );
- }
- }
-
- acf_register_location_type( 'ACF_Location_User_Form' );
- endif;
|