: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
className: "editor-page-attributes__parent",
label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
help: (0,external_wp_i18n_namespaceObject.__)('Choose a parent page.'),
onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300),
hideLabelFromVision: true
function PostParentToggle({
const parentPost = (0,external_wp_data_namespaceObject.useSelect)(select => {
const parentPostId = getEditedPostAttribute('parent');
} = select(external_wp_coreData_namespaceObject.store);
const postTypeSlug = getEditedPostAttribute('type');
return getEntityRecord('postType', postTypeSlug, parentPostId);
const parentTitle = (0,external_wp_element_namespaceObject.useMemo)(() => !parentPost ? (0,external_wp_i18n_namespaceObject.__)('None') : getTitle(parentPost), [parentPost]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
className: "editor-post-parent__panel-toggle",
// translators: %s: Current post parent.
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change parent: %s'), parentTitle),
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Anchor the popover to the middle of the entire row so that it doesn't
// move around when the label changes.
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
className: "editor-post-parent__panel-dropdown",
contentClassName: "editor-post-parent__panel-dialog",
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostParentToggle, {
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-parent",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
title: (0,external_wp_i18n_namespaceObject.__)('Parent'),
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
children: [/* translators: The domain name should be a reserved domain name to prevent linking to third party sites outside the WordPress project's control. You may also wish to use wordpress.org or a wordpress.org sub-domain. */
(0,external_wp_i18n_namespaceObject.__)("Child pages inherit characteristics from their parent, such as URL structure. For instance, if 'Web Design' is a child of 'Services', its URL would be example.org/services/web-design."), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", {
children: [(0,external_wp_i18n_namespaceObject.__)('They also show up as sub-items in the default navigation menu. '), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes'),
children: (0,external_wp_i18n_namespaceObject.__)('Learn more')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesParent, {})]
/* harmony default export */ const page_attributes_parent = (PageAttributesParent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/panel.js
const PANEL_NAME = 'page-attributes';
function AttributesPanel() {
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
} = select(external_wp_coreData_namespaceObject.store);
isEnabled: isEditorPanelEnabled(PANEL_NAME),
postType: getPostType(getEditedPostAttribute('type'))
if (!isEnabled || !postType) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ParentRow, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OrderRow, {})]
* Renders the Page Attributes Panel component.
* @return {Component} The component to be rendered.
function PageAttributesPanel() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AttributesPanel, {})
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/add-template.js
const addTemplate = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z"
/* harmony default export */ const add_template = (addTemplate);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template-modal.js
const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
function CreateNewTemplateModal({
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
defaultBlockTemplate: getEditorSettings().defaultBlockTemplate,
onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord,
getTemplateId: getCurrentTemplateId
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
const submit = async event => {
const newTemplateContent = defaultBlockTemplate !== null && defaultBlockTemplate !== void 0 ? defaultBlockTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/site-title'), (0,external_wp_blocks_namespaceObject.createBlock)('core/site-tagline')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/separator'), (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', {
const newTemplate = await createTemplate({
slug: (0,external_wp_url_namespaceObject.cleanForSlug)(title || DEFAULT_TITLE),
content: newTemplateContent,
title: title || DEFAULT_TITLE
onNavigateToEntityRecord({
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
className: "editor-post-template__create-form",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
placeholder: DEFAULT_TITLE,
help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
children: (0,external_wp_i18n_namespaceObject.__)('Create')
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/hooks.js
function useEditedPostContext() {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
postId: getCurrentPostId(),
postType: getCurrentPostType()
function useAllowSwitchingTemplates() {
} = useEditedPostContext();
return (0,external_wp_data_namespaceObject.useSelect)(select => {
} = select(external_wp_coreData_namespaceObject.store);
const siteSettings = getEntityRecord('root', 'site');
const templates = getEntityRecords('postType', 'wp_template', {
const isPostsPage = +postId === siteSettings?.page_for_posts;
// If current page is set front page or posts page, we also need
// to check if the current theme has a template for it. If not
const isFrontPage = postType === 'page' && +postId === siteSettings?.page_on_front && templates?.some(({
}) => slug === 'front-page');
return !isPostsPage && !isFrontPage;
function useTemplates(postType) {
return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', {
function useAvailableTemplates(postType) {
const currentTemplateSlug = useCurrentTemplateSlug();
const allowSwitchingTemplate = useAllowSwitchingTemplates();
const templates = useTemplates(postType);
return (0,external_wp_element_namespaceObject.useMemo)(() => allowSwitchingTemplate && templates?.filter(template => template.is_custom && template.slug !== currentTemplateSlug && !!template.content.raw // Skip empty templates.
), [templates, currentTemplateSlug, allowSwitchingTemplate]);
function useCurrentTemplateSlug() {
} = useEditedPostContext();
const templates = useTemplates(postType);
const entityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => {
const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId);
// If a page has a `template` set and is not included in the list
// of the theme's templates, do not return it, in order to resolve
// to the current theme's default template.
return templates?.find(template => template.slug === entityTemplate)?.slug;
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/classic-theme.js
className: 'editor-post-template__dropdown',
placement: 'bottom-start'
function PostTemplateToggle({
const templateTitle = (0,external_wp_data_namespaceObject.useSelect)(select => {
const templateSlug = select(store_store).getEditedPostAttribute('template');
} = select(store_store).getEditorSettings();
if (!supportsTemplateMode && availableTemplates[templateSlug]) {
return availableTemplates[templateSlug];
const template = select(external_wp_coreData_namespaceObject.store).canUser('create', 'templates') && select(store_store).getCurrentTemplateId();
return template?.title || template?.slug || availableTemplates?.[templateSlug];
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Template options'),
children: templateTitle !== null && templateTitle !== void 0 ? templateTitle : (0,external_wp_i18n_namespaceObject.__)('Default template')
* Renders the dropdown content for selecting a post template.
* @param {Object} props The component props.
* @param {Function} props.onClose The function to close the dropdown.
* @return {JSX.Element} The rendered dropdown content.
function PostTemplateDropdownContent({
var _options$find, _selectedOption$value;
const allowSwitchingTemplate = useAllowSwitchingTemplates();
onNavigateToEntityRecord,
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
} = select(external_wp_coreData_namespaceObject.store);
const editorSettings = select(store_store).getEditorSettings();
const canCreateTemplates = canUser('create', 'templates');
const _currentTemplateId = select(store_store).getCurrentTemplateId();
availableTemplates: editorSettings.availableTemplates,
fetchedTemplates: canCreateTemplates ? getEntityRecords('postType', 'wp_template', {
post_type: select(store_store).getCurrentPostType(),
selectedTemplateSlug: select(store_store).getEditedPostAttribute('template'),
canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode,
canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode && !!_currentTemplateId,
currentTemplateId: _currentTemplateId,
onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,
getEditorSettings: select(store_store).getEditorSettings
}, [allowSwitchingTemplate]);
const options = (0,external_wp_element_namespaceObject.useMemo)(() => Object.entries({
...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(({
}) => [slug, title.rendered]))
}).map(([slug, title]) => ({
})), [availableTemplates, fetchedTemplates]);
const selectedOption = (_options$find = options.find(option => option.value === selectedTemplateSlug)) !== null && _options$find !== void 0 ? _options$find : options.find(option => !option.value); // The default option has '' value.
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-template__classic-theme-dropdown",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
title: (0,external_wp_i18n_namespaceObject.__)('Template'),
help: (0,external_wp_i18n_namespaceObject.__)('Templates define the way content is displayed when viewing your site.'),
label: (0,external_wp_i18n_namespaceObject.__)('Add template'),
onClick: () => setIsCreateModalOpen(true)
}), !allowSwitchingTemplate ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
children: (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.')
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
hideLabelFromVision: true,
label: (0,external_wp_i18n_namespaceObject.__)('Template'),
value: (_selectedOption$value = selectedOption?.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '',
onChange: slug => editPost({
}), canEdit && onNavigateToEntityRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
onNavigateToEntityRecord({
postId: currentTemplateId,