BlockPattern
    
            
            in package
            
        
    
    
    
BlockPattern Module class.
Table of Contents
Properties
- $action_hook : ActionHook
 - ActionHook instance.
 - $pattern_name : string
 - Block pattern name.
 - $pattern_properties : array<string|int, mixed>
 - Block pattern properties.
 
Methods
- __construct() : mixed
 - Constructor.
 - __toString() : string
 - Custom toString magic method.
 - register_block_pattern() : void
 - Registers the block pattern with WordPress.
 - initialize() : void
 - Initializes the block pattern.
 
Properties
$action_hook
ActionHook instance.
    private
        ActionHook
    $action_hook
    
    
        ActionHook object for the register_block_pattern method.
Tags
$pattern_name
Block pattern name.
    private
        string
    $pattern_name
    
    
        Block pattern name including namespace.
Tags
$pattern_properties
Block pattern properties.
    private
        array<string|int, mixed>
    $pattern_properties
    
    
        List of properties for the block pattern.
Tags
Methods
__construct()
Constructor.
    public
                    __construct(string $pattern_name, array<string|int, mixed> $pattern_properties[, ActionHook $action_hook = null ]) : mixed
    Constructs the BlockPattern object by setting the pattern name, pattern properties, and action hook.
Parameters
- $pattern_name : string
 - 
                    
Block pattern name including namespace.
 - $pattern_properties : array<string|int, mixed>
 - 
                    
List of properties for the block pattern.
 - $action_hook : ActionHook = null
 - 
                    
Optional. ActionHook instance. Default 'init'.
 
Tags
__toString()
Custom toString magic method.
    public
                    __toString() : string
    Returns the block pattern as a JSON string.
Tags
Return values
string —JSON string.
register_block_pattern()
Registers the block pattern with WordPress.
    public
                    register_block_pattern() : void
    Uses the register_block_pattern() function to register the block pattern.
Tags
initialize()
Initializes the block pattern.
    private
                    initialize() : void
    Hooks the action to register the block pattern and adds the block pattern to the registry.