File "class-acf-location-page.php"

Full path: /home/kosmetik/public_html/wp-content/plugins/advanced-custom-fields/includes/locations/class-acf-location-page.php
File size: 1.02 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

if (!defined('ABSPATH')) {
    exit;
}
if (!class_exists('ACF_Location_Page')) {
    class ACF_Location_Page extends ACF_Location
    {
        public function initialize()
        {
            $this->name = 'page';
            $this->label = __('Page', 'acf');
            $this->category = 'page';
            $this->object_type = 'post';
            $this->object_subtype = 'page';
        }
        public function match($rule, $screen, $field_group)
        {
            return acf_get_location_type('post')->match($rule, $screen, $field_group);
        }
        public function get_values($rule)
        {
            $choices = array();
            $groups = acf_get_grouped_posts(array('post_type' => array('page')));
            $posts = reset($groups);
            if ($posts) {
                foreach ($posts as $post) {
                    $choices[$post->ID] = acf_get_post_title($post);
                }
            }
            return $choices;
        }
    }
    acf_register_location_type('ACF_Location_Page');
}