Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: editor.js
className: "editor-page-attributes__parent",
[10000] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
[10001] Fix | Delete
help: (0,external_wp_i18n_namespaceObject.__)('Choose a parent page.'),
[10002] Fix | Delete
value: parentPostId,
[10003] Fix | Delete
options: parentOptions,
[10004] Fix | Delete
onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300),
[10005] Fix | Delete
onChange: handleChange,
[10006] Fix | Delete
hideLabelFromVision: true
[10007] Fix | Delete
});
[10008] Fix | Delete
}
[10009] Fix | Delete
function PostParentToggle({
[10010] Fix | Delete
isOpen,
[10011] Fix | Delete
onClick
[10012] Fix | Delete
}) {
[10013] Fix | Delete
const parentPost = (0,external_wp_data_namespaceObject.useSelect)(select => {
[10014] Fix | Delete
const {
[10015] Fix | Delete
getEditedPostAttribute
[10016] Fix | Delete
} = select(store_store);
[10017] Fix | Delete
const parentPostId = getEditedPostAttribute('parent');
[10018] Fix | Delete
if (!parentPostId) {
[10019] Fix | Delete
return null;
[10020] Fix | Delete
}
[10021] Fix | Delete
const {
[10022] Fix | Delete
getEntityRecord
[10023] Fix | Delete
} = select(external_wp_coreData_namespaceObject.store);
[10024] Fix | Delete
const postTypeSlug = getEditedPostAttribute('type');
[10025] Fix | Delete
return getEntityRecord('postType', postTypeSlug, parentPostId);
[10026] Fix | Delete
}, []);
[10027] Fix | Delete
const parentTitle = (0,external_wp_element_namespaceObject.useMemo)(() => !parentPost ? (0,external_wp_i18n_namespaceObject.__)('None') : getTitle(parentPost), [parentPost]);
[10028] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[10029] Fix | Delete
size: "compact",
[10030] Fix | Delete
className: "editor-post-parent__panel-toggle",
[10031] Fix | Delete
variant: "tertiary",
[10032] Fix | Delete
"aria-expanded": isOpen
[10033] Fix | Delete
// translators: %s: Current post parent.
[10034] Fix | Delete
,
[10035] Fix | Delete
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change parent: %s'), parentTitle),
[10036] Fix | Delete
onClick: onClick,
[10037] Fix | Delete
children: parentTitle
[10038] Fix | Delete
});
[10039] Fix | Delete
}
[10040] Fix | Delete
function ParentRow() {
[10041] Fix | Delete
// Use internal state instead of a ref to make sure that the component
[10042] Fix | Delete
// re-renders when the popover's anchor updates.
[10043] Fix | Delete
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
[10044] Fix | Delete
// Memoize popoverProps to avoid returning a new object every time.
[10045] Fix | Delete
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
[10046] Fix | Delete
// Anchor the popover to the middle of the entire row so that it doesn't
[10047] Fix | Delete
// move around when the label changes.
[10048] Fix | Delete
anchor: popoverAnchor,
[10049] Fix | Delete
placement: 'left-start',
[10050] Fix | Delete
offset: 36,
[10051] Fix | Delete
shift: true
[10052] Fix | Delete
}), [popoverAnchor]);
[10053] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
[10054] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
[10055] Fix | Delete
ref: setPopoverAnchor,
[10056] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
[10057] Fix | Delete
popoverProps: popoverProps,
[10058] Fix | Delete
className: "editor-post-parent__panel-dropdown",
[10059] Fix | Delete
contentClassName: "editor-post-parent__panel-dialog",
[10060] Fix | Delete
focusOnMount: true,
[10061] Fix | Delete
renderToggle: ({
[10062] Fix | Delete
isOpen,
[10063] Fix | Delete
onToggle
[10064] Fix | Delete
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostParentToggle, {
[10065] Fix | Delete
isOpen: isOpen,
[10066] Fix | Delete
onClick: onToggle
[10067] Fix | Delete
}),
[10068] Fix | Delete
renderContent: ({
[10069] Fix | Delete
onClose
[10070] Fix | Delete
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[10071] Fix | Delete
className: "editor-post-parent",
[10072] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
[10073] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Parent'),
[10074] Fix | Delete
onClose: onClose
[10075] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[10076] Fix | Delete
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. */
[10077] Fix | Delete
(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", {
[10078] Fix | Delete
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, {
[10079] Fix | Delete
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes'),
[10080] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Learn more')
[10081] Fix | Delete
})]
[10082] Fix | Delete
})]
[10083] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesParent, {})]
[10084] Fix | Delete
})
[10085] Fix | Delete
})
[10086] Fix | Delete
});
[10087] Fix | Delete
}
[10088] Fix | Delete
/* harmony default export */ const page_attributes_parent = (PageAttributesParent);
[10089] Fix | Delete
[10090] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/panel.js
[10091] Fix | Delete
/**
[10092] Fix | Delete
* WordPress dependencies
[10093] Fix | Delete
*/
[10094] Fix | Delete
[10095] Fix | Delete
[10096] Fix | Delete
/**
[10097] Fix | Delete
* Internal dependencies
[10098] Fix | Delete
*/
[10099] Fix | Delete
[10100] Fix | Delete
[10101] Fix | Delete
[10102] Fix | Delete
[10103] Fix | Delete
[10104] Fix | Delete
[10105] Fix | Delete
[10106] Fix | Delete
const PANEL_NAME = 'page-attributes';
[10107] Fix | Delete
function AttributesPanel() {
[10108] Fix | Delete
const {
[10109] Fix | Delete
isEnabled,
[10110] Fix | Delete
postType
[10111] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[10112] Fix | Delete
const {
[10113] Fix | Delete
getEditedPostAttribute,
[10114] Fix | Delete
isEditorPanelEnabled
[10115] Fix | Delete
} = select(store_store);
[10116] Fix | Delete
const {
[10117] Fix | Delete
getPostType
[10118] Fix | Delete
} = select(external_wp_coreData_namespaceObject.store);
[10119] Fix | Delete
return {
[10120] Fix | Delete
isEnabled: isEditorPanelEnabled(PANEL_NAME),
[10121] Fix | Delete
postType: getPostType(getEditedPostAttribute('type'))
[10122] Fix | Delete
};
[10123] Fix | Delete
}, []);
[10124] Fix | Delete
if (!isEnabled || !postType) {
[10125] Fix | Delete
return null;
[10126] Fix | Delete
}
[10127] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[10128] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ParentRow, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OrderRow, {})]
[10129] Fix | Delete
});
[10130] Fix | Delete
}
[10131] Fix | Delete
[10132] Fix | Delete
/**
[10133] Fix | Delete
* Renders the Page Attributes Panel component.
[10134] Fix | Delete
*
[10135] Fix | Delete
* @return {Component} The component to be rendered.
[10136] Fix | Delete
*/
[10137] Fix | Delete
function PageAttributesPanel() {
[10138] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, {
[10139] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AttributesPanel, {})
[10140] Fix | Delete
});
[10141] Fix | Delete
}
[10142] Fix | Delete
[10143] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/add-template.js
[10144] Fix | Delete
/**
[10145] Fix | Delete
* WordPress dependencies
[10146] Fix | Delete
*/
[10147] Fix | Delete
[10148] Fix | Delete
[10149] Fix | Delete
const addTemplate = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
[10150] Fix | Delete
viewBox: "0 0 24 24",
[10151] Fix | Delete
xmlns: "http://www.w3.org/2000/svg",
[10152] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
[10153] Fix | Delete
fillRule: "evenodd",
[10154] Fix | Delete
clipRule: "evenodd",
[10155] Fix | Delete
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"
[10156] Fix | Delete
})
[10157] Fix | Delete
});
[10158] Fix | Delete
/* harmony default export */ const add_template = (addTemplate);
[10159] Fix | Delete
[10160] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template-modal.js
[10161] Fix | Delete
/**
[10162] Fix | Delete
* WordPress dependencies
[10163] Fix | Delete
*/
[10164] Fix | Delete
[10165] Fix | Delete
[10166] Fix | Delete
[10167] Fix | Delete
[10168] Fix | Delete
[10169] Fix | Delete
[10170] Fix | Delete
[10171] Fix | Delete
/**
[10172] Fix | Delete
* Internal dependencies
[10173] Fix | Delete
*/
[10174] Fix | Delete
[10175] Fix | Delete
[10176] Fix | Delete
[10177] Fix | Delete
[10178] Fix | Delete
const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
[10179] Fix | Delete
function CreateNewTemplateModal({
[10180] Fix | Delete
onClose
[10181] Fix | Delete
}) {
[10182] Fix | Delete
const {
[10183] Fix | Delete
defaultBlockTemplate,
[10184] Fix | Delete
onNavigateToEntityRecord
[10185] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[10186] Fix | Delete
const {
[10187] Fix | Delete
getEditorSettings,
[10188] Fix | Delete
getCurrentTemplateId
[10189] Fix | Delete
} = select(store_store);
[10190] Fix | Delete
return {
[10191] Fix | Delete
defaultBlockTemplate: getEditorSettings().defaultBlockTemplate,
[10192] Fix | Delete
onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord,
[10193] Fix | Delete
getTemplateId: getCurrentTemplateId
[10194] Fix | Delete
};
[10195] Fix | Delete
});
[10196] Fix | Delete
const {
[10197] Fix | Delete
createTemplate
[10198] Fix | Delete
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
[10199] Fix | Delete
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
[10200] Fix | Delete
const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
[10201] Fix | Delete
const cancel = () => {
[10202] Fix | Delete
setTitle('');
[10203] Fix | Delete
onClose();
[10204] Fix | Delete
};
[10205] Fix | Delete
const submit = async event => {
[10206] Fix | Delete
event.preventDefault();
[10207] Fix | Delete
if (isBusy) {
[10208] Fix | Delete
return;
[10209] Fix | Delete
}
[10210] Fix | Delete
setIsBusy(true);
[10211] Fix | Delete
const newTemplateContent = defaultBlockTemplate !== null && defaultBlockTemplate !== void 0 ? defaultBlockTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
[10212] Fix | Delete
tagName: 'header',
[10213] Fix | Delete
layout: {
[10214] Fix | Delete
inherit: true
[10215] Fix | Delete
}
[10216] Fix | Delete
}, [(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', {
[10217] Fix | Delete
tagName: 'main'
[10218] Fix | Delete
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
[10219] Fix | Delete
layout: {
[10220] Fix | Delete
inherit: true
[10221] Fix | Delete
}
[10222] Fix | Delete
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', {
[10223] Fix | Delete
layout: {
[10224] Fix | Delete
inherit: true
[10225] Fix | Delete
}
[10226] Fix | Delete
})])]);
[10227] Fix | Delete
const newTemplate = await createTemplate({
[10228] Fix | Delete
slug: (0,external_wp_url_namespaceObject.cleanForSlug)(title || DEFAULT_TITLE),
[10229] Fix | Delete
content: newTemplateContent,
[10230] Fix | Delete
title: title || DEFAULT_TITLE
[10231] Fix | Delete
});
[10232] Fix | Delete
setIsBusy(false);
[10233] Fix | Delete
onNavigateToEntityRecord({
[10234] Fix | Delete
postId: newTemplate.id,
[10235] Fix | Delete
postType: 'wp_template'
[10236] Fix | Delete
});
[10237] Fix | Delete
cancel();
[10238] Fix | Delete
};
[10239] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
[10240] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'),
[10241] Fix | Delete
onRequestClose: cancel,
[10242] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
[10243] Fix | Delete
className: "editor-post-template__create-form",
[10244] Fix | Delete
onSubmit: submit,
[10245] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
[10246] Fix | Delete
spacing: "3",
[10247] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
[10248] Fix | Delete
__nextHasNoMarginBottom: true,
[10249] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
[10250] Fix | Delete
value: title,
[10251] Fix | Delete
onChange: setTitle,
[10252] Fix | Delete
placeholder: DEFAULT_TITLE,
[10253] Fix | Delete
disabled: isBusy,
[10254] Fix | Delete
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.')
[10255] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
[10256] Fix | Delete
justify: "right",
[10257] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[10258] Fix | Delete
variant: "tertiary",
[10259] Fix | Delete
onClick: cancel,
[10260] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
[10261] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[10262] Fix | Delete
variant: "primary",
[10263] Fix | Delete
type: "submit",
[10264] Fix | Delete
isBusy: isBusy,
[10265] Fix | Delete
"aria-disabled": isBusy,
[10266] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Create')
[10267] Fix | Delete
})]
[10268] Fix | Delete
})]
[10269] Fix | Delete
})
[10270] Fix | Delete
})
[10271] Fix | Delete
});
[10272] Fix | Delete
}
[10273] Fix | Delete
[10274] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/hooks.js
[10275] Fix | Delete
/**
[10276] Fix | Delete
* WordPress dependencies
[10277] Fix | Delete
*/
[10278] Fix | Delete
[10279] Fix | Delete
[10280] Fix | Delete
[10281] Fix | Delete
[10282] Fix | Delete
/**
[10283] Fix | Delete
* Internal dependencies
[10284] Fix | Delete
*/
[10285] Fix | Delete
[10286] Fix | Delete
function useEditedPostContext() {
[10287] Fix | Delete
return (0,external_wp_data_namespaceObject.useSelect)(select => {
[10288] Fix | Delete
const {
[10289] Fix | Delete
getCurrentPostId,
[10290] Fix | Delete
getCurrentPostType
[10291] Fix | Delete
} = select(store_store);
[10292] Fix | Delete
return {
[10293] Fix | Delete
postId: getCurrentPostId(),
[10294] Fix | Delete
postType: getCurrentPostType()
[10295] Fix | Delete
};
[10296] Fix | Delete
}, []);
[10297] Fix | Delete
}
[10298] Fix | Delete
function useAllowSwitchingTemplates() {
[10299] Fix | Delete
const {
[10300] Fix | Delete
postType,
[10301] Fix | Delete
postId
[10302] Fix | Delete
} = useEditedPostContext();
[10303] Fix | Delete
return (0,external_wp_data_namespaceObject.useSelect)(select => {
[10304] Fix | Delete
const {
[10305] Fix | Delete
getEntityRecord,
[10306] Fix | Delete
getEntityRecords
[10307] Fix | Delete
} = select(external_wp_coreData_namespaceObject.store);
[10308] Fix | Delete
const siteSettings = getEntityRecord('root', 'site');
[10309] Fix | Delete
const templates = getEntityRecords('postType', 'wp_template', {
[10310] Fix | Delete
per_page: -1
[10311] Fix | Delete
});
[10312] Fix | Delete
const isPostsPage = +postId === siteSettings?.page_for_posts;
[10313] Fix | Delete
// If current page is set front page or posts page, we also need
[10314] Fix | Delete
// to check if the current theme has a template for it. If not
[10315] Fix | Delete
const isFrontPage = postType === 'page' && +postId === siteSettings?.page_on_front && templates?.some(({
[10316] Fix | Delete
slug
[10317] Fix | Delete
}) => slug === 'front-page');
[10318] Fix | Delete
return !isPostsPage && !isFrontPage;
[10319] Fix | Delete
}, [postId, postType]);
[10320] Fix | Delete
}
[10321] Fix | Delete
function useTemplates(postType) {
[10322] Fix | Delete
return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', {
[10323] Fix | Delete
per_page: -1,
[10324] Fix | Delete
post_type: postType
[10325] Fix | Delete
}), [postType]);
[10326] Fix | Delete
}
[10327] Fix | Delete
function useAvailableTemplates(postType) {
[10328] Fix | Delete
const currentTemplateSlug = useCurrentTemplateSlug();
[10329] Fix | Delete
const allowSwitchingTemplate = useAllowSwitchingTemplates();
[10330] Fix | Delete
const templates = useTemplates(postType);
[10331] Fix | Delete
return (0,external_wp_element_namespaceObject.useMemo)(() => allowSwitchingTemplate && templates?.filter(template => template.is_custom && template.slug !== currentTemplateSlug && !!template.content.raw // Skip empty templates.
[10332] Fix | Delete
), [templates, currentTemplateSlug, allowSwitchingTemplate]);
[10333] Fix | Delete
}
[10334] Fix | Delete
function useCurrentTemplateSlug() {
[10335] Fix | Delete
const {
[10336] Fix | Delete
postType,
[10337] Fix | Delete
postId
[10338] Fix | Delete
} = useEditedPostContext();
[10339] Fix | Delete
const templates = useTemplates(postType);
[10340] Fix | Delete
const entityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => {
[10341] Fix | Delete
const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId);
[10342] Fix | Delete
return post?.template;
[10343] Fix | Delete
}, [postType, postId]);
[10344] Fix | Delete
if (!entityTemplate) {
[10345] Fix | Delete
return;
[10346] Fix | Delete
}
[10347] Fix | Delete
// If a page has a `template` set and is not included in the list
[10348] Fix | Delete
// of the theme's templates, do not return it, in order to resolve
[10349] Fix | Delete
// to the current theme's default template.
[10350] Fix | Delete
return templates?.find(template => template.slug === entityTemplate)?.slug;
[10351] Fix | Delete
}
[10352] Fix | Delete
[10353] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/classic-theme.js
[10354] Fix | Delete
/**
[10355] Fix | Delete
* WordPress dependencies
[10356] Fix | Delete
*/
[10357] Fix | Delete
[10358] Fix | Delete
[10359] Fix | Delete
[10360] Fix | Delete
[10361] Fix | Delete
[10362] Fix | Delete
[10363] Fix | Delete
[10364] Fix | Delete
[10365] Fix | Delete
[10366] Fix | Delete
/**
[10367] Fix | Delete
* Internal dependencies
[10368] Fix | Delete
*/
[10369] Fix | Delete
[10370] Fix | Delete
[10371] Fix | Delete
[10372] Fix | Delete
[10373] Fix | Delete
[10374] Fix | Delete
const POPOVER_PROPS = {
[10375] Fix | Delete
className: 'editor-post-template__dropdown',
[10376] Fix | Delete
placement: 'bottom-start'
[10377] Fix | Delete
};
[10378] Fix | Delete
function PostTemplateToggle({
[10379] Fix | Delete
isOpen,
[10380] Fix | Delete
onClick
[10381] Fix | Delete
}) {
[10382] Fix | Delete
const templateTitle = (0,external_wp_data_namespaceObject.useSelect)(select => {
[10383] Fix | Delete
const templateSlug = select(store_store).getEditedPostAttribute('template');
[10384] Fix | Delete
const {
[10385] Fix | Delete
supportsTemplateMode,
[10386] Fix | Delete
availableTemplates
[10387] Fix | Delete
} = select(store_store).getEditorSettings();
[10388] Fix | Delete
if (!supportsTemplateMode && availableTemplates[templateSlug]) {
[10389] Fix | Delete
return availableTemplates[templateSlug];
[10390] Fix | Delete
}
[10391] Fix | Delete
const template = select(external_wp_coreData_namespaceObject.store).canUser('create', 'templates') && select(store_store).getCurrentTemplateId();
[10392] Fix | Delete
return template?.title || template?.slug || availableTemplates?.[templateSlug];
[10393] Fix | Delete
}, []);
[10394] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[10395] Fix | Delete
__next40pxDefaultSize: true,
[10396] Fix | Delete
variant: "tertiary",
[10397] Fix | Delete
"aria-expanded": isOpen,
[10398] Fix | Delete
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Template options'),
[10399] Fix | Delete
onClick: onClick,
[10400] Fix | Delete
children: templateTitle !== null && templateTitle !== void 0 ? templateTitle : (0,external_wp_i18n_namespaceObject.__)('Default template')
[10401] Fix | Delete
});
[10402] Fix | Delete
}
[10403] Fix | Delete
[10404] Fix | Delete
/**
[10405] Fix | Delete
* Renders the dropdown content for selecting a post template.
[10406] Fix | Delete
*
[10407] Fix | Delete
* @param {Object} props The component props.
[10408] Fix | Delete
* @param {Function} props.onClose The function to close the dropdown.
[10409] Fix | Delete
*
[10410] Fix | Delete
* @return {JSX.Element} The rendered dropdown content.
[10411] Fix | Delete
*/
[10412] Fix | Delete
function PostTemplateDropdownContent({
[10413] Fix | Delete
onClose
[10414] Fix | Delete
}) {
[10415] Fix | Delete
var _options$find, _selectedOption$value;
[10416] Fix | Delete
const allowSwitchingTemplate = useAllowSwitchingTemplates();
[10417] Fix | Delete
const {
[10418] Fix | Delete
availableTemplates,
[10419] Fix | Delete
fetchedTemplates,
[10420] Fix | Delete
selectedTemplateSlug,
[10421] Fix | Delete
canCreate,
[10422] Fix | Delete
canEdit,
[10423] Fix | Delete
currentTemplateId,
[10424] Fix | Delete
onNavigateToEntityRecord,
[10425] Fix | Delete
getEditorSettings
[10426] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[10427] Fix | Delete
const {
[10428] Fix | Delete
canUser,
[10429] Fix | Delete
getEntityRecords
[10430] Fix | Delete
} = select(external_wp_coreData_namespaceObject.store);
[10431] Fix | Delete
const editorSettings = select(store_store).getEditorSettings();
[10432] Fix | Delete
const canCreateTemplates = canUser('create', 'templates');
[10433] Fix | Delete
const _currentTemplateId = select(store_store).getCurrentTemplateId();
[10434] Fix | Delete
return {
[10435] Fix | Delete
availableTemplates: editorSettings.availableTemplates,
[10436] Fix | Delete
fetchedTemplates: canCreateTemplates ? getEntityRecords('postType', 'wp_template', {
[10437] Fix | Delete
post_type: select(store_store).getCurrentPostType(),
[10438] Fix | Delete
per_page: -1
[10439] Fix | Delete
}) : undefined,
[10440] Fix | Delete
selectedTemplateSlug: select(store_store).getEditedPostAttribute('template'),
[10441] Fix | Delete
canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode,
[10442] Fix | Delete
canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode && !!_currentTemplateId,
[10443] Fix | Delete
currentTemplateId: _currentTemplateId,
[10444] Fix | Delete
onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,
[10445] Fix | Delete
getEditorSettings: select(store_store).getEditorSettings
[10446] Fix | Delete
};
[10447] Fix | Delete
}, [allowSwitchingTemplate]);
[10448] Fix | Delete
const options = (0,external_wp_element_namespaceObject.useMemo)(() => Object.entries({
[10449] Fix | Delete
...availableTemplates,
[10450] Fix | Delete
...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(({
[10451] Fix | Delete
slug,
[10452] Fix | Delete
title
[10453] Fix | Delete
}) => [slug, title.rendered]))
[10454] Fix | Delete
}).map(([slug, title]) => ({
[10455] Fix | Delete
value: slug,
[10456] Fix | Delete
label: title
[10457] Fix | Delete
})), [availableTemplates, fetchedTemplates]);
[10458] Fix | Delete
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.
[10459] Fix | Delete
[10460] Fix | Delete
const {
[10461] Fix | Delete
editPost
[10462] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
[10463] Fix | Delete
const {
[10464] Fix | Delete
createSuccessNotice
[10465] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
[10466] Fix | Delete
const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
[10467] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[10468] Fix | Delete
className: "editor-post-template__classic-theme-dropdown",
[10469] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
[10470] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Template'),
[10471] Fix | Delete
help: (0,external_wp_i18n_namespaceObject.__)('Templates define the way content is displayed when viewing your site.'),
[10472] Fix | Delete
actions: canCreate ? [{
[10473] Fix | Delete
icon: add_template,
[10474] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Add template'),
[10475] Fix | Delete
onClick: () => setIsCreateModalOpen(true)
[10476] Fix | Delete
}] : [],
[10477] Fix | Delete
onClose: onClose
[10478] Fix | Delete
}), !allowSwitchingTemplate ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
[10479] Fix | Delete
status: "warning",
[10480] Fix | Delete
isDismissible: false,
[10481] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.')
[10482] Fix | Delete
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
[10483] Fix | Delete
__next40pxDefaultSize: true,
[10484] Fix | Delete
__nextHasNoMarginBottom: true,
[10485] Fix | Delete
hideLabelFromVision: true,
[10486] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Template'),
[10487] Fix | Delete
value: (_selectedOption$value = selectedOption?.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '',
[10488] Fix | Delete
options: options,
[10489] Fix | Delete
onChange: slug => editPost({
[10490] Fix | Delete
template: slug || ''
[10491] Fix | Delete
})
[10492] Fix | Delete
}), canEdit && onNavigateToEntityRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
[10493] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[10494] Fix | Delete
variant: "link",
[10495] Fix | Delete
onClick: () => {
[10496] Fix | Delete
onNavigateToEntityRecord({
[10497] Fix | Delete
postId: currentTemplateId,
[10498] Fix | Delete
postType: 'wp_template'
[10499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function