acf_field_flexible_content::get_layoutpublicACF 5.5.8

This function will return a specific layout by name from a field

Method of the class: acf_field_flexible_content{}

No Hooks.

Returns

Array|false.

Usage

$acf_field_flexible_content = new acf_field_flexible_content();
$acf_field_flexible_content->get_layout( $name, $field );
$name(string) (required)
.
$field(array) (required)
.

Changelog

Since 5.5.8 Introduced.

acf_field_flexible_content::get_layout() code ACF 6.0.4

function get_layout( $name, $field ) {

	// bail early if no layouts
	if ( ! isset( $field['layouts'] ) ) {
		return false;
	}

	// loop
	foreach ( $field['layouts'] as $layout ) {

		// match
		if ( $layout['name'] === $name ) {
			return $layout;
		}
	}

	// return
	return false;

}