Skip to content

Commit

Permalink
Add filter for the Preferences modal sections
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Mar 15, 2021
1 parent bf159e6 commit 507dde1
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions packages/edit-post/src/components/preferences-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
store as editorStore,
} from '@wordpress/editor';
import { store as coreStore } from '@wordpress/core-data';
import { applyFilters } from '@wordpress/hooks';

/**
* Internal dependencies
Expand Down Expand Up @@ -71,8 +72,8 @@ export default function PreferencesModal() {
},
[ isLargeViewport ]
);
const sections = useMemo(
() => [
const sections = useMemo( () => {
const defaultSections = [
{
name: 'general',
tabLabel: __( 'General' ),
Expand Down Expand Up @@ -234,9 +235,18 @@ export default function PreferencesModal() {
</>
),
},
],
[ isViewable, isLargeViewport, showBlockBreadcrumbsOption ]
);
];

/**
* Filters default Preference Modal sections.
*
* @param {Array<Object>} defaultSections Default sections.
*/
return applyFilters(
'editorPost.PreferencesModal.defaultSections',
defaultSections
);
}, [ isViewable, isLargeViewport, showBlockBreadcrumbsOption ] );

// This is also used to sync the two different rendered components
// between small and large viewports.
Expand Down

0 comments on commit 507dde1

Please sign in to comment.