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

Full path: /home/kosmetik/public_html/wp-content/plugins/advanced-custom-fields/includes/locations/class-acf-location-widget.php
File size: 1.1 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_Widget')) {
    class ACF_Location_Widget extends ACF_Location
    {
        public function initialize()
        {
            $this->name = 'widget';
            $this->label = __('Widget', 'acf');
            $this->category = 'forms';
            $this->object_type = 'widget';
        }
        public function match($rule, $screen, $field_group)
        {
            if (isset($screen['widget'])) {
                $widget = $screen['widget'];
            } else {
                return false;
            }
            return $this->compare_to_rule($widget, $rule);
        }
        public function get_values($rule)
        {
            global $wp_widget_factory;
            $choices = array('all' => __('All', 'acf'));
            if ($wp_widget_factory->widgets) {
                foreach ($wp_widget_factory->widgets as $widget) {
                    $choices[$widget->id_base] = $widget->name;
                }
            }
            return $choices;
        }
    }
    acf_register_location_type('ACF_Location_Widget');
}