acf_field_clone::initialize
This function will setup the field type data
Метод класса: acf_field_clone{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$acf_field_clone = new acf_field_clone(); $acf_field_clone->initialize();
Список изменений
| С версии 5.0.0 | Введена. |
Код acf_field_clone::initialize() acf field clone::initialize ACF 6.4.2
function initialize() {
// vars
$this->name = 'clone';
$this->label = _x( 'Clone', 'noun', 'acf' );
$this->category = 'layout';
$this->description = __( 'Allows you to select and display existing fields. It does not duplicate any fields in the database, but loads and displays the selected fields at run-time. The Clone field can either replace itself with the selected fields or display the selected fields as a group of subfields.', 'acf' );
$this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-clone.png';
$this->doc_url = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/clone/', 'docs', 'field-type-selection' );
$this->tutorial_url = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/how-to-use-the-clone-field/', 'docs', 'field-type-selection' );
$this->pro = true;
$this->supports = array( 'bindings' => false );
$this->defaults = array(
'clone' => '',
'prefix_label' => 0,
'prefix_name' => 0,
'display' => 'seamless',
'layout' => 'block',
);
$this->cloning = array();
$this->have_rows = 'single';
// register filter
acf_enable_filter( 'clone' );
// ajax
add_action( 'wp_ajax_acf/fields/clone/query', array( $this, 'ajax_query' ) );
// filters
add_filter( 'acf/get_fields', array( $this, 'acf_get_fields' ), 5, 2 );
add_filter( 'acf/prepare_field', array( $this, 'acf_prepare_field' ), 10, 1 );
add_filter( 'acf/clone_field', array( $this, 'acf_clone_field' ), 10, 2 );
}