acf_field_flexible_content::get_layout_title
Method of the class: acf_field_flexible_content{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$acf_field_flexible_content = new acf_field_flexible_content(); $acf_field_flexible_content->get_layout_title( $field, $layout, $i, $value );
- $field(required)
- .
- $layout(required)
- .
- $i(required)
- .
- $value(required)
- .
acf_field_flexible_content::get_layout_title() acf field flexible content::get layout title code ACF 6.0.4
function get_layout_title( $field, $layout, $i, $value ) {
// vars
$rows = array();
$rows[ $i ] = $value;
// add loop
acf_add_loop(
array(
'selector' => $field['name'],
'name' => $field['name'],
'value' => $rows,
'field' => $field,
'i' => $i,
'post_id' => 0,
)
);
// vars
$title = $layout['label'];
// filters
$title = apply_filters( 'acf/fields/flexible_content/layout_title', $title, $field, $layout, $i );
$title = apply_filters( 'acf/fields/flexible_content/layout_title/name=' . $field['_name'], $title, $field, $layout, $i );
$title = apply_filters( 'acf/fields/flexible_content/layout_title/key=' . $field['key'], $title, $field, $layout, $i );
// remove loop
acf_remove_loop();
// prepend order
$order = is_numeric( $i ) ? $i + 1 : 0;
$title = '<span class="acf-fc-layout-order">' . $order . '</span> ' . acf_esc_html( $title );
// return
return $title;
}