@@ -26,6 +26,19 @@ trait StoreBlocksTrait
2626 */
2727 public static $ styles = [];
2828
29+ /**
30+ * Get filters.
31+ *
32+ * @return array<mixed>
33+ */
34+ private const FILTERS_PREFIX = [
35+ AbstractManifestCache::BLOCKS_KEY => 'es_boilerplate_get_blocks ' ,
36+ AbstractManifestCache::COMPONENTS_KEY => 'es_boilerplate_get_components ' ,
37+ AbstractManifestCache::VARIATIONS_KEY => 'es_boilerplate_get_variations ' ,
38+ AbstractManifestCache::WRAPPER_KEY => 'es_boilerplate_get_wrapper ' ,
39+ AbstractManifestCache::SETTINGS_KEY => 'es_boilerplate_get_settings ' ,
40+ ];
41+
2942 // -----------------------------------------------------
3043 // BLOCKS
3144 // -----------------------------------------------------
@@ -45,10 +58,10 @@ public static function getBlocks(): array
4558 throw InvalidBlock::missingItemException ('project ' , 'blocks ' );
4659 }
4760
48- $ filterName = ' es_boilerplate_get_blocks ' ;
61+ $ filterName = self :: FILTERS_PREFIX [AbstractManifestCache:: BLOCKS_KEY ] ;
4962
5063 if (\has_filter ($ filterName )) {
51- $ output = \apply_filters ($ filterName , $ output , CacheTrait ::getCacheName ());
64+ $ output = \apply_filters ($ filterName , $ output , Helpers ::getCacheName ());
5265 }
5366
5467 return $ output ;
@@ -89,6 +102,12 @@ public static function getComponents(): array
89102 throw InvalidBlock::missingItemException ('project ' , 'components ' );
90103 }
91104
105+ $ filterName = self ::FILTERS_PREFIX [AbstractManifestCache::COMPONENTS_KEY ];
106+
107+ if (\has_filter ($ filterName )) {
108+ $ output = \apply_filters ($ filterName , $ output , Helpers::getCacheName ());
109+ }
110+
92111 return $ output ;
93112 }
94113
@@ -127,6 +146,12 @@ public static function getVariations(): array
127146 throw InvalidBlock::missingItemException ('project ' , 'variations ' );
128147 }
129148
149+ $ filterName = self ::FILTERS_PREFIX [AbstractManifestCache::VARIATIONS_KEY ];
150+
151+ if (\has_filter ($ filterName )) {
152+ $ output = \apply_filters ($ filterName , $ output , Helpers::getCacheName ());
153+ }
154+
130155 return $ output ;
131156 }
132157
@@ -165,6 +190,12 @@ public static function getWrapper(): array
165190 throw InvalidBlock::missingItemException ('blocks wrapper ' , 'component ' );
166191 }
167192
193+ $ filterName = self ::FILTERS_PREFIX [AbstractManifestCache::WRAPPER_KEY ];
194+
195+ if (\has_filter ($ filterName )) {
196+ $ output = \apply_filters ($ filterName , $ output , Helpers::getCacheName ());
197+ }
198+
168199 return $ output ;
169200 }
170201
@@ -281,6 +312,12 @@ public static function getSettings(): array
281312 throw InvalidBlock::missingItemException ('project ' , 'global settings ' );
282313 }
283314
315+ $ filterName = self ::FILTERS_PREFIX [AbstractManifestCache::SETTINGS_KEY ];
316+
317+ if (\has_filter ($ filterName )) {
318+ $ output = \apply_filters ($ filterName , $ output , Helpers::getCacheName ());
319+ }
320+
284321 return $ output ;
285322 }
286323
0 commit comments