ACF\Pro\Fields\FlexibleContent

Render::layoutsprivateACF 6.5

Renders the layouts for a Flexible Content field.

Method of the class: Render{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->layouts();

Changelog

Since 6.5 Introduced.

Render::layouts() code ACF 6.8.8

private function layouts() {
	echo '<div class="values">';

	$disabled_layouts = ! empty( $this->layout_meta['disabled'] ) ? $this->layout_meta['disabled'] : array();
	$renamed_layouts  = ! empty( $this->layout_meta['renamed'] ) ? $this->layout_meta['renamed'] : array();

	if ( ! empty( $this->field['value'] ) ) {
		foreach ( $this->field['value'] as $order => $value ) {
			if ( ! is_array( $value ) ) {
				continue;
			}

			if ( empty( $this->layouts[ $value['acf_fc_layout'] ] ) ) {
				continue;
			}

			$layout = new Layout(
				$this->field,
				$this->layouts[ $value['acf_fc_layout'] ],
				$order,
				$value,
				in_array( $order, $disabled_layouts, true ),
				! empty( $renamed_layouts[ $order ] ) ? $renamed_layouts[ $order ] : '',
			);

			$layout->render();
		}
	}

	echo '</div>';
}