acf_field_flexible_content::initialize
This function will setup the field type data
Метод класса: acf_field_flexible_content{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$acf_field_flexible_content = new acf_field_flexible_content(); $acf_field_flexible_content->initialize();
Список изменений
| С версии 5.0.0 | Введена. |
Код acf_field_flexible_content::initialize() acf field flexible content::initialize ACF 6.4.2
public function initialize() {
// vars
$this->name = 'flexible_content';
$this->label = __( 'Flexible Content', 'acf' );
$this->category = 'layout';
$this->description = __( 'Allows you to define, create and manage content with total control by creating layouts that contain subfields that content editors can choose from.', 'acf' ) . ' ' . __( 'We do not recommend using this field in ACF Blocks.', 'acf' );
$this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-flexible-content.png';
$this->doc_url = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/flexible-content/', 'docs', 'field-type-selection' );
$this->tutorial_url = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/building-layouts-with-the-flexible-content-field-in-a-theme/', 'docs', 'field-type-selection' );
$this->pro = true;
$this->supports = array( 'bindings' => false );
$this->defaults = array(
'layouts' => array(),
'min' => '',
'max' => '',
'button_label' => __( 'Add Row', 'acf' ),
);
// ajax
$this->add_action( 'wp_ajax_acf/fields/flexible_content/layout_title', array( $this, 'ajax_layout_title' ) );
$this->add_action( 'wp_ajax_nopriv_acf/fields/flexible_content/layout_title', array( $this, 'ajax_layout_title' ) );
// filters
$this->add_filter( 'acf/prepare_field_for_export', array( $this, 'prepare_any_field_for_export' ) );
$this->add_filter( 'acf/clone_field', array( $this, 'clone_any_field' ), 10, 2 );
$this->add_filter( 'acf/validate_field', array( $this, 'validate_any_field' ) );
// field filters
$this->add_field_filter( 'acf/get_sub_field', array( $this, 'get_sub_field' ), 10, 3 );
$this->add_field_filter( 'acf/prepare_field_for_export', array( $this, 'prepare_field_for_export' ) );
$this->add_field_filter( 'acf/prepare_field_for_import', array( $this, 'prepare_field_for_import' ) );
}