[ 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 }, 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 activityTypes, 32 } 33 } = bp; 34 35 const editDynamicActivitiesBlock = ( { attributes, setAttributes } ) => { 36 const { postId, maxActivities, type, title } = attributes; 37 const post = currentPostId(); 38 const types = activityTypes(); 39 40 if ( ! postId && post ) { 41 setAttributes( { postId: post } ); 42 if ( ! attributes.postId ) { 43 attributes.postId = post; 44 } 45 } 46 47 return ( 48 <Fragment> 49 <InspectorControls> 50 <PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true } className="bp-latest-activities"> 51 <TextControl 52 label={ __( 'Title', 'buddypress' ) } 53 value={ title } 54 onChange={ ( text ) => { 55 setAttributes( { title: text } ); 56 } } 57 /> 58 <RangeControl 59 label={ __( 'Maximum amount to display', 'buddypress' ) } 60 value={ maxActivities } 61 onChange={ ( value ) => 62 setAttributes( { maxActivities: value } ) 63 } 64 min={ 1 } 65 max={ 10 } 66 required 67 /> 68 <SelectControl 69 multiple 70 label={ __( 'Type', 'buddypress' ) } 71 value={ type } 72 options={ types } 73 onChange={ ( option ) => { 74 setAttributes( { type: option } ); 75 } } 76 /> 77 </PanelBody> 78 </InspectorControls> 79 <Disabled> 80 <ServerSideRender block="bp/latest-activities" attributes={ attributes } /> 81 </Disabled> 82 </Fragment> 83 ); 84 }; 85 86 export default editDynamicActivitiesBlock;
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 |