| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 var __create = Object.create; 2 var __defProp = Object.defineProperty; 3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 4 var __getOwnPropNames = Object.getOwnPropertyNames; 5 var __getProtoOf = Object.getPrototypeOf; 6 var __hasOwnProp = Object.prototype.hasOwnProperty; 7 var __commonJS = (cb, mod) => function __require() { 8 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 9 }; 10 var __copyProps = (to, from, except, desc) => { 11 if (from && typeof from === "object" || typeof from === "function") { 12 for (let key of __getOwnPropNames(from)) 13 if (!__hasOwnProp.call(to, key) && key !== except) 14 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 15 } 16 return to; 17 }; 18 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 19 // If the importer is in node compatibility mode or this is not an ESM 20 // file that has been converted to a CommonJS file using a Babel- 21 // compatible transform (i.e. "__esModule" has not been set), then set 22 // "default" to the CommonJS "module.exports" for node compatibility. 23 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 24 mod 25 )); 26 27 // package-external:@wordpress/data 28 var require_data = __commonJS({ 29 "package-external:@wordpress/data"(exports, module) { 30 module.exports = window.wp.data; 31 } 32 }); 33 34 // package-external:@wordpress/core-data 35 var require_core_data = __commonJS({ 36 "package-external:@wordpress/core-data"(exports, module) { 37 module.exports = window.wp.coreData; 38 } 39 }); 40 41 // package-external:@wordpress/i18n 42 var require_i18n = __commonJS({ 43 "package-external:@wordpress/i18n"(exports, module) { 44 module.exports = window.wp.i18n; 45 } 46 }); 47 48 // routes/navigation-list/route.ts 49 var import_data = __toESM(require_data()); 50 var import_core_data = __toESM(require_core_data()); 51 var import_i18n = __toESM(require_i18n()); 52 var NAVIGATION_POST_TYPE = "wp_navigation"; 53 var PRELOADED_NAVIGATION_MENUS_QUERY = { 54 per_page: -1, 55 status: ["publish", "draft"], 56 order: "desc", 57 orderby: "date" 58 }; 59 var route = { 60 title: () => (0, import_i18n.__)("Navigation"), 61 canvas: async ({ 62 search 63 }) => { 64 const [firstNavigation] = await (0, import_data.resolveSelect)( 65 import_core_data.store 66 ).getEntityRecords( 67 "postType", 68 NAVIGATION_POST_TYPE, 69 PRELOADED_NAVIGATION_MENUS_QUERY 70 ); 71 if (!firstNavigation) { 72 return { postType: NAVIGATION_POST_TYPE, isPreview: true }; 73 } 74 const postId = search.ids ? parseInt(search.ids[0]) : firstNavigation.id; 75 return { 76 postType: NAVIGATION_POST_TYPE, 77 postId, 78 isPreview: true, 79 editLink: `/types/wp_navigation/edit/$postId}` 80 }; 81 }, 82 loader: async () => { 83 await Promise.all([ 84 // Preload navigation menus 85 (0, import_data.resolveSelect)(import_core_data.store).getEntityRecords( 86 "postType", 87 NAVIGATION_POST_TYPE, 88 PRELOADED_NAVIGATION_MENUS_QUERY 89 ), 90 (0, import_data.resolveSelect)(import_core_data.store).canUser("create", { 91 kind: "postType", 92 name: NAVIGATION_POST_TYPE 93 }), 94 // Preload post type object (what usePostFields needs) 95 (0, import_data.resolveSelect)(import_core_data.store).getPostType(NAVIGATION_POST_TYPE), 96 // Preload users data (what usePostFields needs for author field) 97 (0, import_data.resolveSelect)(import_core_data.store).getEntityRecords("root", "user", { 98 per_page: -1 99 }) 100 ]); 101 } 102 }; 103 export { 104 route 105 };
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Fri Apr 17 08:20:10 2026 | Cross-referenced by PHPXref |