Automattic\WooCommerce\Blocks\Patterns

PTKPatternsStore::filter_patternsprivateWC 1.0

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() code WC 9.9.4

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;
			}
		)
	);
}