acf_field_flexible_content::ajax_layout_title()publicACF 5.3.2

ajax_layout_title

description

Метод класса: acf_field_flexible_content{}

Хуков нет.

Возвращает

$post_id. (int)

Использование

$acf_field_flexible_content = new acf_field_flexible_content();
$acf_field_flexible_content->ajax_layout_title();

Список изменений

С версии 5.3.2 Введена.

Код acf_field_flexible_content::ajax_layout_title() ACF 6.0.4

function ajax_layout_title() {

	$options = acf_parse_args(
		$_POST, // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified elsewhere.
		array(
			'post_id'   => 0,
			'i'         => 0,
			'field_key' => '',
			'nonce'     => '',
			'layout'    => '',
			'value'     => array(),
		)
	);

	// load field
	$field = acf_get_field( $options['field_key'] );
	if ( ! $field ) {
		die();
	}

	// vars
	$layout = $this->get_layout( $options['layout'], $field );
	if ( ! $layout ) {
		die();
	}

	// title
	$title = $this->get_layout_title( $field, $layout, $options['i'], $options['value'] );

	// echo
	echo $title;
	die;

}