PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.4.0
GenerateBlocks v1.4.0
trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.3.0
generateblocks / src / blocks / button-container / deprecated.js
generateblocks / src / blocks / button-container Last commit date
css 4 years ago attributes.js 4 years ago block.js 4 years ago deprecated.js 5 years ago edit.js 4 years ago editor.scss 5 years ago
deprecated.js
66 lines
1 /**
2 * External dependencies
3 */
4 import classnames from 'classnames';
5 import blockAttributes from './attributes';
6
7 import {
8 InnerBlocks,
9 } from '@wordpress/block-editor';
10
11 import {
12 applyFilters,
13 } from '@wordpress/hooks';
14
15 const deprecated = [
16 // v1 of container block. Deprecated the gb-grid-column wrapper in save component.
17 {
18 attributes: blockAttributes,
19 supports: {
20 anchor: false,
21 className: false,
22 customClassName: false,
23 },
24 migrate( attributes ) {
25 const oldClasses = attributes.cssClasses ? attributes.cssClasses : attributes.className;
26 const oldAnchor = attributes.elementId ? attributes.elementId : attributes.anchor;
27
28 return {
29 ...attributes,
30 className: oldClasses,
31 anchor: oldAnchor,
32 cssClasses: '',
33 elementId: '',
34 };
35 },
36 save( { attributes } ) {
37 const {
38 uniqueId,
39 elementId,
40 cssClasses,
41 } = attributes;
42
43 let htmlAttributes = {
44 id: !! elementId ? elementId : undefined,
45 className: classnames( {
46 'gb-button-wrapper': true,
47 [ `gb-button-wrapper-${ uniqueId }` ]: true,
48 [ `${ cssClasses }` ]: '' !== cssClasses,
49 } ),
50 };
51
52 htmlAttributes = applyFilters( 'generateblocks.frontend.htmlAttributes', htmlAttributes, 'generateblocks/button-container', attributes );
53
54 return (
55 <div
56 { ...htmlAttributes }
57 >
58 <InnerBlocks.Content />
59 </div>
60 );
61 },
62 },
63 ];
64
65 export default deprecated;
66