WooCommerce Code Reference

PatternRegistry
in package

PatternRegistry class.

Table of Contents

COMMA_SEPARATED_REGEX  = '/[\s,]+/'
SLUG_REGEX  = '/^[A-z0-9\/_-]+$/'
register_block_pattern()  : void
Register a block pattern.
get_pattern_from_dictionary()  : array<string|int, mixed>|null
Filter the patterns dictionary to get the pattern data corresponding to the pattern slug.

Constants

Methods

register_block_pattern()

Register a block pattern.

public register_block_pattern(string $source, array<string|int, mixed> $pattern_data, array<string|int, mixed> $dictionary) : void
Parameters
$source : string

The pattern source.

$pattern_data : array<string|int, mixed>

The pattern data.

$dictionary : array<string|int, mixed>

The patterns' dictionary.

Return values
void

get_pattern_from_dictionary()

Filter the patterns dictionary to get the pattern data corresponding to the pattern slug.

private get_pattern_from_dictionary(array<string|int, mixed> $dictionary, string $slug) : array<string|int, mixed>|null
Parameters
$dictionary : array<string|int, mixed>

The patterns' dictionary.

$slug : string

The pattern slug.

Return values
array<string|int, mixed>|null