Automattic\WooCommerce\Blocks\Assets
AssetDataRegistry::add
Interface for adding data to the registry.
You can only register data that is not already in the registry identified by the given key. If there is a duplicate found, unless $ignore_duplicates is true, an exception will be thrown.
Метод класса: AssetDataRegistry{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$AssetDataRegistry = new AssetDataRegistry(); $AssetDataRegistry->add( $key, $data, $check_key_exists );
- $key(строка) (обязательный)
- The key used to reference the data being registered. This should use camelCase.
- $data(разное) (обязательный)
- If not a function, registered to the registry as is. If a function, then the callback is invoked right before output to the screen.
- $check_key_exists(true|false)
- Deprecated. Duplicate data will be ignored if the key exists.
По умолчанию:false
Код AssetDataRegistry::add() AssetDataRegistry::add WC 11.0.0
public function add( $key, $data, $check_key_exists = false ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- Deprecated parameter kept for backwards compatibility.
if ( 3 <= func_num_args() ) {
wc_deprecated_argument(
__METHOD__ . '()',
'8.9',
'The $check_key_exists parameter is no longer used: all duplicate data will be ignored if the key exists by default'
);
}
$this->add_data( $key, $data );
}