WP_Interactivity_API::get_context
Returns the latest value on the context stack with the passed namespace.
When the namespace is omitted, it uses the current namespace on the namespace stack during a process_directives call.
Метод класса: WP_Interactivity_API{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WP_Interactivity_API = new WP_Interactivity_API(); $WP_Interactivity_API->get_context( ?string $store_namespace ): array;
- ?string $store_namespace
- .
По умолчанию: null
Список изменений
| С версии 6.6.0 | Введена. |
Код WP_Interactivity_API::get_context() WP Interactivity API::get context WP 6.9
public function get_context( ?string $store_namespace = null ): array {
if ( null === $this->context_stack ) {
_doing_it_wrong(
__METHOD__,
__( 'The context can only be read during directive processing.' ),
'6.6.0'
);
return array();
}
if ( ! $store_namespace ) {
if ( null !== $store_namespace ) {
_doing_it_wrong(
__METHOD__,
__( 'The namespace should be a non-empty string.' ),
'6.6.0'
);
return array();
}
$store_namespace = end( $this->namespace_stack );
}
$context = end( $this->context_stack );
return ( $store_namespace && $context && isset( $context[ $store_namespace ] ) )
? $context[ $store_namespace ]
: array();
}