ACF\Pro\Fields\FlexibleContent

Render::add_layout_menuprivateACF 6.5

Renders the dropdown menu to add more layouts.

Method of the class: Render{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

Changelog

Since 6.5 Introduced.

Render::add_layout_menu() code ACF 6.8.8

private function add_layout_menu() {
	echo '<script type="text-html" class="tmpl-popup"><ul>';
	foreach ( $this->layouts as $layout ) {
		$safe_label = acf_esc_html( $layout['label'] );
		$atts       = array(
			'href'        => '#',
			'data-layout' => $layout['name'],
			'data-min'    => $layout['min'],
			'data-max'    => $layout['max'],
			'title'       => $safe_label,
		);
		printf( '<li><a %s>%s</a></li>', acf_esc_attrs( $atts ), $safe_label ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped above.
	}
	echo '</ul></script>';
}