[ 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 ToggleControl, 14 }, 15 element: { 16 Fragment, 17 createElement, 18 }, 19 i18n: { 20 __, 21 }, 22 serverSideRender: ServerSideRender, 23 } = wp; 24 25 /** 26 * BuddyPress dependencies. 27 */ 28 const { 29 blockData: { 30 currentPostId, 31 } 32 } = bp; 33 34 /** 35 * Internal dependencies. 36 */ 37 import { TYPES } from './constants'; 38 39 const editDynamicFriendsBlock = ( { attributes, setAttributes } ) => { 40 const { postId, maxFriends, friendDefault, linkTitle } = attributes; 41 const post = currentPostId(); 42 43 if ( ! postId && post ) { 44 setAttributes( { postId: post } ); 45 } 46 47 return ( 48 <Fragment> 49 <InspectorControls> 50 <PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }> 51 <RangeControl 52 label={ __( 'Max friends to show', 'buddypress' ) } 53 value={ maxFriends } 54 onChange={ ( value ) => 55 setAttributes( { maxFriends: value } ) 56 } 57 min={ 1 } 58 max={ 10 } 59 required 60 /> 61 <SelectControl 62 label={ __( 'Default members to show', 'buddypress' ) } 63 value={ friendDefault } 64 options={ TYPES } 65 onChange={ ( option ) => { 66 setAttributes( { friendDefault: option } ); 67 } } 68 /> 69 <ToggleControl 70 label={ __( 'Link block title to Member\'s profile friends page', 'buddypress' ) } 71 checked={ !! linkTitle } 72 onChange={ () => { 73 setAttributes( { linkTitle: ! linkTitle } ); 74 } } 75 /> 76 </PanelBody> 77 </InspectorControls> 78 <Disabled> 79 <ServerSideRender block="bp/friends" attributes={ attributes } /> 80 </Disabled> 81 </Fragment> 82 ); 83 }; 84 85 export default editDynamicFriendsBlock;
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 |