PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.8.2
GenerateBlocks v1.8.2
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 / extend / dynamic-content / inspector-controls / PostDateControl.js
generateblocks / src / extend / dynamic-content / inspector-controls Last commit date
AuthorMetaControl.js 3 years ago CommentsControl.js 4 years ago ContentTypeControl.js 4 years ago DynamicSourceControl.js 3 years ago ExcerptControl.js 4 years ago LinkTypeControl.js 3 years ago PostDateControl.js 4 years ago PostMetaControl.js 3 years ago TermsControl.js 4 years ago
PostDateControl.js
33 lines
1 import { SelectControl, ToggleControl } from '@wordpress/components';
2 import { __ } from '@wordpress/i18n';
3
4 export default function PostDateControl( props ) {
5 const { isActive = false, dateType, dateReplacePublished, setAttributes } = props;
6
7 return (
8 <>
9 { isActive &&
10 <>
11 <SelectControl
12 label={ __( 'Date type', 'generateblocks' ) }
13 value={ dateType }
14 options={ [
15 { value: 'published', label: __( 'Published', 'generateblocks' ) },
16 { value: 'updated', label: __( 'Updated', 'generateblocks' ) },
17 ] }
18 onChange={ ( value ) => setAttributes( { dateType: value } ) }
19 />
20
21 { 'published' === dateType &&
22 <ToggleControl
23 label={ __( 'Replace with updated date', 'generateblocks' ) }
24 checked={ !! dateReplacePublished }
25 onChange={ ( value ) => setAttributes( { dateReplacePublished: value } ) }
26 />
27 }
28 </>
29 }
30 </>
31 );
32 }
33