Automattic\WooCommerce\Blocks

BlockPatterns::get_pattern_from_dictionary()privateWC 1.0

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

Method of the class: BlockPatterns{}

No Hooks.

Return

Array|null.

Usage

// private - for code of main (parent) class only
$result = $this->get_pattern_from_dictionary( $dictionary, $slug );
$dictionary(array) (required)
The patterns dictionary.
$slug(string) (required)
The pattern slug.

BlockPatterns::get_pattern_from_dictionary() code WC 9.0.1

private function get_pattern_from_dictionary( $dictionary, $slug ) {
	foreach ( $dictionary as $pattern_dictionary ) {
		if ( isset( $pattern_dictionary['slug'] ) && $pattern_dictionary['slug'] === $slug ) {
			return $pattern_dictionary;
		}
	}

	return null;
}