[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 /** 2 * WordPress dependencies. 3 */ 4 const { 5 blockEditor: { 6 InspectorControls, 7 }, 8 components: { 9 Disabled, 10 PanelBody, 11 RangeControl, 12 SelectControl, 13 TextControl, 14 ToggleControl, 15 }, 16 element: { 17 Fragment, 18 createElement, 19 }, 20 i18n: { 21 __, 22 }, 23 serverSideRender: ServerSideRender, 24 } = wp; 25 26 /** 27 * BuddyPress dependencies. 28 */ 29 const { 30 blockData: { 31 isActive, 32 } 33 } = bp; 34 35 /** 36 * Internal dependencies. 37 */ 38 import { TYPES } from './constants'; 39 40 const editDynamicMembersBlock = ( { attributes, setAttributes } ) => { 41 const { title, maxMembers, memberDefault, linkTitle } = attributes; 42 const sortTypes = !! isActive( 'friends' ) ? TYPES : TYPES.filter( ( type ) => 'popular' !== type.value ); 43 44 return ( 45 <Fragment> 46 <InspectorControls> 47 <PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }> 48 <TextControl 49 label={ __( 'Title', 'buddypress' ) } 50 value={ title } 51 onChange={ ( text ) => { 52 setAttributes( { title: text } ); 53 } } 54 /> 55 <RangeControl 56 label={ __( 'Max members to show', 'buddypress' ) } 57 value={ maxMembers } 58 onChange={ ( value ) => 59 setAttributes( { maxMembers: value } ) 60 } 61 min={ 1 } 62 max={ 10 } 63 required 64 /> 65 <SelectControl 66 label={ __( 'Default members to show', 'buddypress' ) } 67 value={ memberDefault } 68 options={ sortTypes } 69 onChange={ ( option ) => { 70 setAttributes( { memberDefault: option } ); 71 } } 72 /> 73 <ToggleControl 74 label={ __( 'Link block title to Members directory', 'buddypress' ) } 75 checked={ !! linkTitle } 76 onChange={ () => { 77 setAttributes( { linkTitle: ! linkTitle } ); 78 } } 79 /> 80 </PanelBody> 81 </InspectorControls> 82 <Disabled> 83 <ServerSideRender block="bp/dynamic-members" attributes={ attributes } /> 84 </Disabled> 85 </Fragment> 86 ); 87 }; 88 89 export default editDynamicMembersBlock;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri May 5 01:01:24 2023 | Cross-referenced by PHPXref 0.7.1 |