Automattic\WooCommerce\StoreApi\Schemas
ExtendSchema::register_update_callback()
Add callback functions that can be executed by the cart/extensions endpoint.
Метод класса: ExtendSchema{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$ExtendSchema = new ExtendSchema(); $ExtendSchema->register_update_callback( $args );
- $args(массив) (обязательный)
An array of elements that make up the callback configuration.
-
namespace(строка)
Required. Plugin namespace. - callback(callable)
Required. The function/callable to execute.
-
Код ExtendSchema::register_update_callback() ExtendSchema::register update callback WC 7.7.2
public function register_update_callback( $args ) { $args = wp_parse_args( $args, [ 'namespace' => '', 'callback' => null, ] ); if ( ! is_string( $args['namespace'] ) || empty( $args['namespace'] ) ) { throw new \Exception( 'You must provide a plugin namespace when extending a Store REST endpoint.' ); } if ( ! is_callable( $args['callback'] ) ) { throw new \Exception( 'There is no valid callback supplied to register_update_callback.' ); } $this->callback_methods[ $args['namespace'] ] = $args; }