Automattic\WooCommerce\Blocks\Patterns
PTKPatternsStore::filter_patterns
Filter the patterns that have external dependencies.
Method of the class: PTKPatternsStore{}
No Hooks.
Returns
Array.
Usage
// private - for code of main (parent) class only $result = $this->filter_patterns( $patterns );
- $patterns(array) (required)
- The patterns to filter.
PTKPatternsStore::filter_patterns() PTKPatternsStore::filter patterns code WC 10.6.2
private function filter_patterns( array $patterns ) {
return array_values(
array_filter(
$patterns,
function ( $pattern ) {
if ( ! isset( $pattern['ID'] ) ) {
return true;
}
if ( isset( $pattern['post_type'] ) && 'wp_block' !== $pattern['post_type'] ) {
return false;
}
if ( $this->has_external_dependencies( $pattern ) ) {
return false;
}
return true;
}
)
);
}