/** * WordPress dependencies. */ const { blockEditor: { InspectorControls, }, components: { Disabled, Notice, PanelBody, ToggleControl, }, element: { Fragment, createElement, }, i18n: { __, }, serverSideRender: ServerSideRender, } = wp; /** * BuddyPress dependencies. */ const { blockData: { getCurrentWidgetsSidebar, } } = bp; const editPrimaryNavBlock = ( { attributes, setAttributes, clientId } ) => { const { displayTitle } = attributes; const currentSidebar = getCurrentWidgetsSidebar( clientId ); const disabledSidebars = ['sidebar-buddypress-members', 'sidebar-buddypress-groups']; if ( currentSidebar && currentSidebar.id && -1 !== disabledSidebars.indexOf( currentSidebar.id ) ) { return (

{ __( 'The BuddyPress Primary Navigation block shouldn\'t be used into this widget area. Please remove it.', 'buddypress' ) }

); } return ( { setAttributes( { displayTitle: ! displayTitle } ); } } /> ); }; export default editPrimaryNavBlock;