acf_prepare_field()ACF 5.7.10

acf_prepare_field

Prepare a field for input.

Хуки из функции

Возвращает

Массив.

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

acf_prepare_field( $field );
$field(массив) (обязательный)
The field array.

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

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

Код acf_prepare_field() ACF 5.10.2

function acf_prepare_field( $field ) {

	// Bail early if already prepared.
	if ( ! empty( $field['_prepare'] ) ) {
		return $field;
	}

	// Use field key to override input name.
	if ( $field['key'] ) {
		$field['name'] = $field['key'];
	}

	// Use field prefix to modify input name.
	if ( $field['prefix'] ) {
		$field['name'] = "{$field['prefix']}[{$field['name']}]";
	}

	// Generate id attribute from name.
	$field['id'] = acf_idify( $field['name'] );

	// Add state to field.
	$field['_prepare'] = true;

	/**
	 * Filters the $field array.
	 *
	 * Allows developers to modify field settings or return false to remove field.
	 *
	 * @date    12/02/2014
	 * @since   5.0.0
	 *
	 * @param   array $field The field array.
	 */
	$field = apply_filters( 'acf/prepare_field', $field );

	// return
	return $field;
}