123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- if ( ! defined( 'ABSPATH' ) ) {
- exit;
- }
- if ( ! class_exists( 'ACF_Location_Taxonomy' ) ) :
- class ACF_Location_Taxonomy extends ACF_Location {
-
- public function initialize() {
- $this->name = 'taxonomy';
- $this->label = __( 'Taxonomy', 'acf' );
- $this->category = 'forms';
- $this->object_type = 'term';
- }
-
- public function match( $rule, $screen, $field_group ) {
-
- if ( isset( $screen['taxonomy'] ) ) {
- $taxonomy = $screen['taxonomy'];
- } else {
- return false;
- }
-
- return $this->compare_to_rule( $taxonomy, $rule );
- }
-
- public function get_values( $rule ) {
- return array_merge(
- array(
- 'all' => __( 'All', 'acf' ),
- ),
- acf_get_taxonomy_labels()
- );
- }
-
- function get_object_subtype( $rule ) {
- if ( $rule['operator'] === '==' ) {
- return $rule['value'];
- }
- return '';
- }
- }
-
- acf_register_location_type( 'ACF_Location_Taxonomy' );
- endif;
|