acf_field_clone::get_clone_setting_field_choice()publicACF 5.4.0

get_clone_setting_field_choice

This function will return the text for a field choice

Метод класса: acf_field_clone{}

Хуков нет.

Возвращает

(Строку).

Использование

$acf_field_clone = new acf_field_clone();
$acf_field_clone->get_clone_setting_field_choice( $field );
$field (обязательный)
-

Список изменений

С версии 5.4.0 Введена.

Код acf_field_clone::get_clone_setting_field_choice() ACF 6.0.4

function get_clone_setting_field_choice( $field ) {

	// bail early if no field
	if ( ! $field ) {
		return __( 'Unknown field', 'acf' );
	}

	// title
	$title = $field['label'] ? $field['label'] : __( '(no title)', 'acf' );

	// append type
	$title .= ' (' . $field['type'] . ')';

	// ancestors
	// - allow for AJAX to send through ancestors count
	$ancestors = isset( $field['ancestors'] ) ? $field['ancestors'] : count( acf_get_field_ancestors( $field ) );
	$title     = str_repeat( '- ', $ancestors ) . $title;

	// return
	return $title;

}