Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patterns: Add a preference to disable the loading the of the choose pattern modal #56307

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/edit-post/src/components/preferences-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ export default function EditPostPreferencesModal() {
) }
label={ __( 'Use theme styles' ) }
/>
<EnableFeature
featureName="enableChoosePatternModal"
help={ __(
'Enables the choose pattern modal when adding a new page.'
) }
label={ __( 'Enable choose pattern modal' ) }
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the copy could be tweaked as a lot of users won't know what a modal is.

Something like "Show starter patterns" / "Shows starter patterns when creating a new page.".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

{ showBlockBreadcrumbsOption && (
<EnableFeature
featureName="showBlockBreadcrumbs"
Expand Down
9 changes: 7 additions & 2 deletions packages/edit-post/src/components/start-page-options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { useSelect, useDispatch } from '@wordpress/data';
import { useAsyncList } from '@wordpress/compose';
import { store as editorStore } from '@wordpress/editor';
import { store as preferencesStore } from '@wordpress/preferences';

/**
* Internal dependencies
Expand Down Expand Up @@ -92,11 +93,15 @@ export default function StartPageOptions() {
const shouldEnableModal = useSelect( ( select ) => {
const { isCleanNewPost } = select( editorStore );
const { isEditingTemplate, isFeatureActive } = select( editPostStore );

const enableChoosePatternModal = select( preferencesStore ).get(
'core/edit-post',
'enableChoosePatternModal'
);
return (
! isEditingTemplate() &&
! isFeatureActive( 'welcomeGuide' ) &&
isCleanNewPost()
isCleanNewPost() &&
enableChoosePatternModal
);
}, [] );

Expand Down
1 change: 1 addition & 0 deletions packages/edit-post/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function initializeEditor(
showBlockBreadcrumbs: true,
showIconLabels: false,
showListViewByDefault: false,
enableChoosePatternModal: true,
themeStyles: true,
welcomeGuide: true,
welcomeGuideTemplate: true,
Expand Down