WP_View_Config_Data::setpublicWP 7.1.0

Replaces whole top-level keys, leaving the rest of the configuration alone.

Like merge() and replace(), set() applies a patch of top-level keys and touches only the keys the patch names: a key the patch omits keeps whatever it had, and a null value drops the key it names (which resets it to its default). The difference is depth — where merge() and replace() merge a named key's value into the current one key by key, set() swaps the whole value in wholesale, dropping whatever the key held before. A null nested within that value still drops the property it names, so set() honours nulls at every depth just as merge() and replace() do.

Use it when a callback owns a key outright and wants to pin it to an exact shape, without the inherited default leaking through a key-by-key merge.

A patch that declares an unsupported schema version is rejected and does not change anything.

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

Хуков нет.

Возвращает

WP_View_Config_Data. The instance, for chaining.

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

$WP_View_Config_Data = new WP_View_Config_Data();
$WP_View_Config_Data->set( $patch, $version );
$patch(массив) (обязательный)
The partial configuration whose named keys to replace.
$version(int) (обязательный)
The schema version the patch was authored against.

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

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

Код WP_View_Config_Data::set() WP 7.1.2

public function set( array $patch, int $version ) {
	return $this->apply( $patch, $version, __METHOD__, 'set' );
}