Documentation

BlockPatternCategory
in package

BlockPatternCategory Module class.

Table of Contents

Properties

$action_hook  : ActionHook
ActionHook instance.
$category_name  : string
Block pattern category name.
$category_properties  : array<string|int, mixed>
Block pattern category properties.

Methods

__construct()  : mixed
Constructor.
__toString()  : string
Custom toString magic method.
register_block_pattern_category()  : void
Registers the block pattern category with WordPress.
initialize()  : void
Initializes the block pattern category.

Properties

$action_hook

ActionHook instance.

private ActionHook $action_hook

ActionHook object for the register_block_pattern_category method.

Tags
since
1.0.0

Methods

__construct()

Constructor.

public __construct(string $category_name, array<string|int, mixed> $category_properties[, ActionHook $action_hook = null ]) : mixed

Constructs the BlockPatternCategory object by setting the category name, category properties, and action hook.

Parameters
$category_name : string

Block pattern category name.

$category_properties : array<string|int, mixed>

Block pattern category properties.

$action_hook : ActionHook = null

Optional. ActionHook instance. Default 'init'.

Tags
since
1.0.0

__toString()

Custom toString magic method.

public __toString() : string

Returns the block pattern category as a JSON string.

Tags
since
1.0.0
Return values
string

JSON string.

initialize()

Initializes the block pattern category.

private initialize() : void

Hooks the action to register the block pattern category and adds the block pattern category to the registry.

Tags
since
1.0.0

        
On this page

Search results