acf_field_flexible_content::get_layout_title
Get a layout title for a field.
Метод класса: acf_field_flexible_content{}
Хуки из метода
Возвращает
Строку. The layout title, optionally filtered.
Использование
$acf_field_flexible_content = new acf_field_flexible_content(); $acf_field_flexible_content->get_layout_title( $field, $layout, $i, $value );
- $field(массив) (обязательный)
- The field array.
- $layout(массив) (обязательный)
- The layout array.
- $i(int) (обязательный)
- The order number of the layout.
- $value(массив) (обязательный)
- The value of the layout.
Код acf_field_flexible_content::get_layout_title() acf field flexible content::get layout title ACF 6.4.2
public 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 $title;
}