ACF_Media::wp_prepare_attachment_for_js()publicACF 5.9.7

Filters attachment data as it is being prepared for JS.

{} Это метод класса: ACF_Media{}

Хуков нет.

Возвращает

Массив.

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

$ACF_Media = new ACF_Media();
$ACF_Media->wp_prepare_attachment_for_js( $response, $attachment, $meta );
$response(массив) (обязательный)
Array of prepared attachment data.
$attachment(WP_Post) (обязательный)
Attachment object.
$meta(массив|false) (обязательный)
Array of attachment meta data, or false if there is none.

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

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

Код ACF_Media::wp_prepare_attachment_for_js() ACF 5.10.2

function wp_prepare_attachment_for_js( $response, $attachment, $meta ) {
	$field = $this->get_source_field();

	// Validate the attachment and append any errors.
	$errors                 = acf_validate_attachment( $response, $field, 'prepare' );
	$response['acf_errors'] = false;
	if ( ! empty( $errors ) ) {
		$response['acf_errors'] = implode( '<br />', $errors );
	}

	// Return.
	return $response;
}