PluginProbe
Friends / 2.8.3
Friends v2.8.3
4.3.2 4.3.1 4.3.0 4.2.2 4.2.1 4.2.0 4.1.0 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.0 2.9.1 All 88 releases
friends / blocks / friends-list / src / index.js

index.js in Friends 2.8.3, at blocks/friends-list/src/index.js

59 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from '@wordpress/i18n';
2 import { registerBlockType } from '@wordpress/blocks';
3 import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
4 import { CheckboxControl, PanelBody, SelectControl, TextControl } from '@wordpress/components';
5 import ServerSideRender from '@wordpress/server-side-render';
6
7 registerBlockType( 'friends/friends-list', {
8 apiVersion: 2,
9 edit: function( { attributes, setAttributes } ) {
10 const blockProps = useBlockProps();
11 return (
12 <>
13 <InspectorControls>
14 <PanelBody>
15 <CheckboxControl
16 label={ __( 'Display Users inline', 'friends' ) }
17 checked={ attributes.users_inline }
18 onChange={ users_inline => setAttributes( { users_inline } ) }
19 />
20 <SelectControl
21 label={ __( 'User Types', 'friends' ) }
22 onChange={ user_types => setAttributes( { user_types } ) }
23 value={ attributes.user_types }
24 options={ [
25 {
26 label: __( 'Friends', 'friends' ),
27 value: 'friends',
28 },
29 {
30 label: __( 'Friend requests', 'friends' ),
31 value: 'friend_requests',
32 },
33 {
34 label: __( 'Subscriptions', 'friends' ),
35 value: 'subscriptions',
36 },
37 {
38 label: __( 'Friends + Subscriptions', 'friends' ),
39 value: 'friends_subscriptions',
40 },
41 ] }
42 />
43 </PanelBody>
44 </InspectorControls>
45 <div {...blockProps}>
46 <ServerSideRender
47 block="friends/friends-list"
48 attributes={ attributes }
49 />
50 </div>
51 </>
52 );
53 },
54
55 save() {
56 return null;
57 },
58 } );
59