ACF\Pro\Datastore

REST_Save::restrict_values │ private │ ACF 6.8.11

Restricts decoded values to the fields rendered for the post in the editor, or belonging to field groups located on it.

The editor sends the field lists rendered in its meta boxes as _acf_fields in the _acf blob. They are read from the request, as the meta's sanitize callback keeps them out of the stored meta. Autosaves are matched as the post they belong to.

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

Хуков нет.

Возвращает

array.

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

// private - только в коде основоного (родительского) класса
$result = $this->restrict_values( $post, $values, $raw_meta );
$post(WP_Post) (обязательный)
The post or autosave being saved.
$values(массив) (обязательный)
The decoded values.
$raw_meta(разное) (обязательный)
The _acf meta from the request.

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

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

Код REST_Save::restrict_values() ACF 6.8.11

private function restrict_values( $post, $values, $raw_meta ) {
	$request_values = is_string( $raw_meta ) ? json_decode( $raw_meta, true ) : null;
	$lists          = is_array( $request_values ) && isset( $request_values['_acf_fields'] ) && is_array( $request_values['_acf_fields'] ) ? $request_values['_acf_fields'] : array();

	return acf_filter_save_values(
		$values,
		array_merge(
			_acf_get_post_save_args( $post, 'datastore' ),
			array(
				'lists'           => $lists,
				'flat_clone_keys' => true,
			)
		)
	);
}