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
$category_name
Block pattern category name.
private
string
$category_name
Block pattern category name.
Tags
$category_properties
Block pattern category properties.
private
array<string|int, mixed>
$category_properties
Block pattern category properties.
Tags
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
__toString()
Custom toString magic method.
public
__toString() : string
Returns the block pattern category as a JSON string.
Tags
Return values
string —JSON string.
register_block_pattern_category()
Registers the block pattern category with WordPress.
public
register_block_pattern_category() : void
Uses the register_block_pattern_category()
function to register the block pattern category.
Tags
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.