PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.5.3
GenerateBlocks v1.5.3
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 / block.js
generateblocks / src / blocks / button Last commit date
components 4 years ago 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 4 years ago save.js 4 years ago
block.js
63 lines
1 /**
2 * Block: Buttons
3 */
4
5 import './editor.scss';
6
7 import editButton from './edit';
8 import saveButton from './save';
9 import deprecated from './deprecated';
10 import blockAttributes from './attributes';
11 import getIcon from '../../utils/get-icon';
12 import dynamicContentAttributes from '../../extend/dynamic-content/attributes';
13
14 import {
15 __,
16 } from '@wordpress/i18n';
17
18 import {
19 registerBlockType,
20 } from '@wordpress/blocks';
21 import getContentTypeLabel from '../../extend/dynamic-content/utils/getContentTypeLabel';
22
23 const attributes = Object.assign(
24 {},
25 blockAttributes,
26 dynamicContentAttributes
27 );
28
29 /**
30 * Register our Button block.
31 *
32 * @param {string} name Block name.
33 * @param {Object} settings Block settings.
34 * @return {?WPBlock} The block, if it has been successfully
35 * registered; otherwise `undefined`.
36 */
37 registerBlockType( 'generateblocks/button', {
38 apiVersion: 2,
39 title: __( 'Button', 'generateblocks' ),
40 description: __( 'Drive conversions with beautiful buttons.', 'generateblocks' ),
41 parent: [ 'generateblocks/button-container' ],
42 icon: getIcon( 'button' ),
43 category: 'generateblocks',
44 keywords: [
45 __( 'button' ),
46 __( 'buttons' ),
47 __( 'generate' ),
48 ],
49 attributes,
50 supports: {
51 className: false,
52 inserter: false,
53 reusable: false,
54 },
55 edit: editButton,
56 save: saveButton,
57 deprecated,
58 usesContext: [ 'postId', 'postType', 'generateblocks/query', 'generateblocks/inheritQuery' ],
59 __experimentalLabel: ( attrs ) => (
60 getContentTypeLabel( attrs, __( 'Button', 'generateblocks' ) )
61 ),
62 } );
63