acf_prepare_fields_for_import()ACF 5.0.0

acf_prepare_field_for_import

Returns a modified array of fields ready for import.

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

Возвращает

Массив.

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

acf_prepare_fields_for_import( $fields );
$fields(массив)
An array of fields.
По умолчанию: array()

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

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

Код acf_prepare_fields_for_import() ACF 6.0.4

function acf_prepare_fields_for_import( $fields = array() ) {

	// Ensure array is sequential.
	$fields = array_values( $fields );

	// Prepare each field for import making sure to detect additional sub fields.
	$i = 0;
	while ( $i < count( $fields ) ) {

		// Prepare field.
		$field = acf_prepare_field_for_import( $fields[ $i ] );

		// Update single field.
		if ( isset( $field['key'] ) ) {
			$fields[ $i ] = $field;

			// Insert multiple fields.
		} else {
			array_splice( $fields, $i, 1, $field );
		}

		// Iterate.
		$i++;
	}

	/**
	 * Filters the $fields array before being returned to the import tool.
	 *
	 * @date    12/02/2014
	 * @since   5.0.0
	 *
	 * @param   array $fields The array of fields.
	 */
	return apply_filters( 'acf/prepare_fields_for_import', $fields );
}