File "class-acf-field-tab.php"

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

Download   Open   Edit   Advanced Editor   Back

<?php

if (!class_exists('acf_field_tab')) {
    class acf_field_tab extends acf_field
    {
        function initialize()
        {
            $this->name = 'tab';
            $this->label = __('Tab', 'acf');
            $this->category = 'layout';
            $this->defaults = array('placement' => 'top', 'endpoint' => 0);
        }
        function render_field($field)
        {
            $atts = array('href' => '', 'class' => 'acf-tab-button', 'data-placement' => $field['placement'], 'data-endpoint' => $field['endpoint'], 'data-key' => $field['key']);
            ?>
		<a <?php 
            acf_esc_attr_e($atts);
            ?>><?php 
            echo acf_esc_html($field['label']);
            ?></a>
			<?php 
        }
        function render_field_settings($field)
        {
            acf_render_field_setting($field, array('label' => __('Placement', 'acf'), 'type' => 'select', 'name' => 'placement', 'choices' => array('top' => __('Top aligned', 'acf'), 'left' => __('Left aligned', 'acf'))));
            acf_render_field_setting($field, array('label' => __('Endpoint', 'acf'), 'instructions' => __('Define an endpoint for the previous tabs to stop. This will start a new group of tabs.', 'acf'), 'name' => 'endpoint', 'type' => 'true_false', 'ui' => 1));
        }
        function load_field($field)
        {
            $field['name'] = '';
            $field['instructions'] = '';
            $field['required'] = 0;
            $field['value'] = false;
            return $field;
        }
    }
    acf_register_field_type('acf_field_tab');
}