[ 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 Notice, 11 PanelBody, 12 ToggleControl, 13 }, 14 element: { 15 Fragment, 16 createElement, 17 }, 18 i18n: { 19 __, 20 }, 21 serverSideRender: ServerSideRender, 22 } = wp; 23 24 /** 25 * BuddyPress dependencies. 26 */ 27 const { 28 blockData: { 29 getCurrentWidgetsSidebar, 30 } 31 } = bp; 32 33 const editPrimaryNavBlock = ( { attributes, setAttributes, clientId } ) => { 34 const { displayTitle } = attributes; 35 const currentSidebar = getCurrentWidgetsSidebar( clientId ); 36 const disabledSidebars = ['sidebar-buddypress-members', 'sidebar-buddypress-groups']; 37 38 if ( currentSidebar && currentSidebar.id && -1 !== disabledSidebars.indexOf( currentSidebar.id ) ) { 39 return ( 40 <Notice status="error" isDismissible={ false }> 41 <p> 42 { __( 'The BuddyPress Primary Navigation block shouldn\'t be used into this widget area. Please remove it.', 'buddypress' ) } 43 </p> 44 </Notice> 45 ); 46 } 47 48 return ( 49 <Fragment> 50 <InspectorControls> 51 <PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }> 52 <ToggleControl 53 label={ __( 'Include navigation title', 'buddypress' ) } 54 checked={ !! displayTitle } 55 onChange={ () => { 56 setAttributes( { displayTitle: ! displayTitle } ); 57 } } 58 /> 59 </PanelBody> 60 </InspectorControls> 61 <Disabled> 62 <ServerSideRender block="bp/primary-nav" attributes={ attributes } /> 63 </Disabled> 64 </Fragment> 65 ); 66 }; 67 68 export default editPrimaryNavBlock;
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 |