PluginProbe
ElasticPress / 5.0.1
ElasticPress v5.0.1
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / assets / js / blocks / facets / taxonomy / transforms.js

transforms.js in ElasticPress 5.0.1, at assets/js/blocks/facets/taxonomy/transforms.js

30 lines 588 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies.
3 */
4 import { createBlock } from '@wordpress/blocks';
5
6 /**
7 * Filter by Taxonomy block transforms.
8 */
9 export default {
10 from: [
11 {
12 type: 'block',
13 blocks: ['core/legacy-widget'],
14 isMatch: ({ idBase }) => idBase === 'ep-facet',
15 transform: ({ instance }) => {
16 const { title = null, ...attributes } = instance.raw;
17
18 if (!title) {
19 return createBlock('elasticpress/facet', attributes);
20 }
21
22 return [
23 createBlock('core/heading', { content: title }),
24 createBlock('elasticpress/facet', attributes),
25 ];
26 },
27 },
28 ],
29 };
30