ACF\Pro\Fields\FlexibleContent

Layout::renderpublicACF 6.5

Renders the layout.

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

Хуков нет.

Возвращает

void. Ничего (null).

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

$Layout = new Layout();
$Layout->render();

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

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

Код Layout::render() ACF 6.8.8

public function render() {
	$id    = 'row-' . $this->order;
	$class = 'layout';

	if ( 'acfcloneindex' === $this->order ) {
		$id     = 'acfcloneindex';
		$class .= ' acf-clone';
	}

	$this->prefix = $this->field['name'] . '[' . $id . ']';

	$div_attrs = array(
		'class'        => $class,
		'data-id'      => $id,
		'data-layout'  => $this->layout['name'],
		'data-label'   => $this->layout['label'],
		'data-min'     => $this->layout['min'],
		'data-max'     => $this->layout['max'],
		'data-enabled' => $this->disabled ? 0 : 1,
		'data-renamed' => empty( $this->renamed ) ? 0 : 1,
	);

	echo '<div ' . acf_esc_attrs( $div_attrs ) . '>'; // Layout wrapper div.

	acf_hidden_input(
		array(
			'name'  => $this->prefix . '[acf_fc_layout]',
			'value' => $this->layout['name'],
		)
	);

	acf_hidden_input(
		array(
			'class' => 'acf-fc-layout-disabled',
			'name'  => $this->prefix . '[acf_fc_layout_disabled]',
			'value' => $this->disabled ? 1 : 0,
		)
	);

	acf_hidden_input(
		array(
			'class' => 'acf-fc-layout-custom-label',
			'name'  => $this->prefix . '[acf_fc_layout_custom_label]',
			'value' => $this->renamed,
		)
	);

	$this->action_buttons();

	if ( ! empty( $this->layout['sub_fields'] ) ) {
		if ( 'table' === $this->layout['display'] ) {
			$this->render_as_table();
		} else {
			$this->render_as_div();
		}
	}

	echo '</div>'; // End layout wrapper div.
}