Plugin Directory

Changeset 3100331


Ignore:
Timestamp:
06/10/2024 07:08:59 AM (21 months ago)
Author:
anaid
Message:

Tag 1.0.1

Location:
auto-submenu
Files:
16 added
5 edited

Legend:

Unmodified
Added
Removed
  • auto-submenu/trunk/auto-submenu.php

    r3058332 r3100331  
    44 * Plugin URI: https://wordpress.telodelic.nl/auto-submenu
    55 * Description: Dynamic menus: Add a page to your menu and then let WordPress automatically add the child pages.
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Author: Diana van de Laarschot
    88 * Author URI: https://wordpress.telodelic.nl
     
    248248        // Loop through the menus to find page parent
    249249        foreach ($auto_add as $menu_id) {
     250            $menu_items = wp_get_nav_menu_items($menu_id, array('post_status' => 'publish,draft'));
     251            if (!is_array($menu_items)) {
     252                continue;
     253            }
     254
    250255            // Assumption of current implementation: Top level pages are added to the menu only once.
    251256            $menu_child = NULL;
    252257            $menu_parent = NULL;
    253             $menu_items = wp_get_nav_menu_items($menu_id, array('post_status' => 'publish,draft'));
    254             if (!is_array($menu_items)) {
    255                 continue;
    256             }
    257258
    258259            // Find the child menu item and the parent menu item for this child page
    259260            foreach ($menu_items as $menu_item) {
    260                 // Item already in menu?
    261261                if ($menu_item->object_id == $post->ID) {
    262262                    $menu_child = $menu_item;
    263                     // In menu under the correct parent?
    264                     if ($menu_item->parent_id == $post->post_parent) {
    265                         // Already in the menu under correct parent, skip.
    266                         continue 2;
    267                     }
    268263                }
    269264                if ($menu_item->object_id == $post->post_parent) {
     
    272267            }
    273268
    274             if ($menu_parent) {
    275                 if ($menu_child) {
    276                     // Update the existing child menu item (even if it wasn't moved. Menu order might have changed)
    277                     wp_update_nav_menu_item(
    278                         $menu_id,
    279                         $menu_child->db_id,
    280                         array(
    281                             'menu-item-position' => $post->menu_order,
    282                             'menu-item-object-id' => $post->ID,
    283                             'menu-item-object' => $post->post_type,
    284                             'menu-item-parent-id' => $menu_parent->ID,
    285                             'menu-item-type' => 'post_type',
    286                             'menu-item-status' => 'publish'
    287                         )
    288                     );
    289                 } else {
    290                     // No menu item yet. Add new menu item for child page
    291                     wp_update_nav_menu_item(
    292                         $menu_id,
    293                         0, // New
    294                         array(
    295                             'menu-item-object-id' => $post->ID,
    296                             'menu-item-object' => $post->post_type,
    297                             'menu-item-parent-id' => $menu_parent->ID,
    298                             'menu-item-type' => 'post_type',
    299                             'menu-item-status' => 'publish'
    300                         )
    301                     );
    302                 }
     269            // Parent not in menu, abort.
     270            if ( !$menu_parent ){
     271                break;
     272            }
     273
     274            if ( $menu_child ) {
     275                // Is child menu item already under correct parent? (If so, do nothing)
     276                if ( $menu_child->menu_item_parent != $menu_parent->ID ) {
     277                    // Update the existing child menu item, move to correct parent
     278                    wp_update_nav_menu_item( $menu_id, $menu_child->db_id, array(
     279                        'menu-item-position' => $post->menu_order,
     280                        'menu-item-object-id' => $post->ID,
     281                        'menu-item-object' => $post->post_type,
     282                        'menu-item-parent-id' => $menu_parent->ID,
     283                        'menu-item-type' => 'post_type',
     284                        'menu-item-status' => 'publish'
     285                    ) );
     286                }
     287            } else {
     288                // No menu item yet. Add new menu item for child page
     289                wp_update_nav_menu_item( $menu_id, 0, array(
     290                    'menu-item-position' => $post->menu_order,
     291                    'menu-item-object-id' => $post->ID,
     292                    'menu-item-object' => $post->post_type,
     293                    'menu-item-parent-id' => $menu_parent->ID,
     294                    'menu-item-type' => 'post_type',
     295                    'menu-item-status' => 'publish'
     296                ) );
    303297            }
    304298        }
  • auto-submenu/trunk/readme.txt

    r3058361 r3100331  
    66Tested up to: 6.5
    77Requires PHP: 7.4
    8 Stable tag: 1.0.0
     8Stable Tag: 1.0.1
    99
    1010Dynamic menus: Add a page to your menu and then let WordPress automatically add the child pages.
     
    6565== Changelog ==
    6666
     67= 1.0.1 =
     68
     69Bugfix: Plugin moved page to the bottom of the submenu.
     70
    6771= 1.0.0 =
    6872
     
    7175
    7276= 0.3.1 =
     77
    7378* Confirmed compatibility with WordPress 6.4
    7479
  • auto-submenu/trunk/src/blocks/asm_core_navigation_link/build/index.asset.php

    r3058332 r3100331  
    1 <?php return array('dependencies' => array('react', 'wp-components', 'wp-hooks'), 'version' => '79b72464927ece3b1842');
     1<?php return array('dependencies' => array('react', 'wp-components', 'wp-hooks'), 'version' => '6f2510038351594475c6');
  • auto-submenu/trunk/src/blocks/asm_core_navigation_link/build/index.js

    r3058332 r3100331  
    158158      title: "Auto Submenu",
    159159      initialOpen: false
    160     }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.BaseControl, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Notice, {
    161       isDismissible: false,
    162       status: "warning"
    163     }, wp.i18n.__('Experimental, please report any issues you may encounter.', 'auto-submenu'))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.BaseControl, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, {
     160    }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.BaseControl, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, {
    164161      id: "asm_unfold",
    165162      key: "asm_unfold",
  • auto-submenu/trunk/src/blocks/asm_core_navigation_link/build/index.js.map

    r3058332 r3100331  
    1 {"version":3,"file":"index.js","mappings":";;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,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igation_link/external window \"React\"","webpack://asm_core_navigation_link/external window [\"wp\",\"components\"]","webpack://asm_core_navigation_link/external window [\"wp\",\"hooks\"]","webpack://asm_core_navigation_link/webpack/bootstrap","webpack://asm_core_navigation_link/webpack/runtime/compat get default export","webpack://asm_core_navigation_link/webpack/runtime/define property getters","webpack://asm_core_navigation_link/webpack/runtime/hasOwnProperty shorthand","webpack://asm_core_navigation_link/webpack/runtime/make namespace object","webpack://asm_core_navigation_link/./src/index.jsx"],"sourcesContent":["module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"hooks\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { addFilter } from '@wordpress/hooks';\nimport { BaseControl, Notice, SelectControl, ToggleControl, TextControl, TextareaControl } from '@wordpress/components'\n\nconst { createHigherOrderComponent } = wp.compose;\nconst { InspectorControls } = wp.blockEditor;\nconst { PanelBody, PanelRow } = wp.components;\n\nfunction addASMUnfoldAttribute(settings) {\n\tif (typeof settings.attributes !== 'undefined') {\n\t\tif (settings.name == 'core/navigation-link') {\n\t\t\tsettings.attributes = Object.assign(settings.attributes, {\n\t\t\t\t'asm_unfold': {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t},\n\t\t\t\t'asm_item_depth': {\n\t\t\t\t\ttype: 'integer',\n\t\t\t\t},\n\t\t\t\t'asm_orderby': {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\t'asm_item_titles': {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'asm/unfold',\n\taddASMUnfoldAttribute\n);\n\nconst asmUnfoldControls = createHigherOrderComponent((BlockEdit) => {\n\treturn (props) => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" {...props} />\n\t\t\t\t{props.attributes.kind === 'post-type' && props.attributes.type === 'page'\n\t\t\t\t\t? <InspectorControls>\n\t\t\t\t\t\t<PanelBody title=\"Auto Submenu\" initialOpen={false}>\n\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t<Notice isDismissible={false} status=\"warning\">{wp.i18n.__('Experimental, please report any issues you may encounter.', 'auto-submenu')}</Notice>\n\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tid='asm_unfold'\n\t\t\t\t\t\t\t\t\tkey='asm_unfold'\n\t\t\t\t\t\t\t\t\tlabel={wp.i18n.__('Create submenu containing child pages', 'auto-submenu')}\n\t\t\t\t\t\t\t\t\tchecked={!!props.attributes.asm_unfold}\n\t\t\t\t\t\t\t\t\tonChange={(newValue) => props.setAttributes({ asm_unfold: newValue })}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t{props.attributes.asm_unfold\n\t\t\t\t\t\t\t\t? <>\n\t\t\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={<>\n\t\t\t\t\t\t\t\t\t\t\t\t{wp.i18n.__('Nesting depth', 'auto-submenu')} (max 3)\n\t\t\t\t\t\t\t\t\t\t\t</>}\n\t\t\t\t\t\t\t\t\t\t\tvalue={props.attributes.asm_item_depth > 0 ? props.attributes.asm_item_depth : 3}\n\t\t\t\t\t\t\t\t\t\t\tonChange={(newValue) => props.setAttributes({ asm_item_depth: isNaN(+newValue) || (+newValue) > 3 ? 3 : +newValue })}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t\t\t\t\tlabel={wp.i18n.__('Order by', 'auto-submenu')}\n\t\t\t\t\t\t\t\t\t\t\tvalue={props.attributes.asm_orderby ?? 'none'}\n\t\t\t\t\t\t\t\t\t\t\toptions={[\n\t\t\t\t\t\t\t\t\t\t\t\t{ label: wp.i18n.__('Menu Order', 'auto-submenu'), value: 'menu_order' }\n\t\t\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\t\t\tonChange={(newValue) => props.setAttributes({ asm_orderby: newValue })}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={<>\n\t\t\t\t\t\t\t\t\t\t\t\t{wp.i18n.__('Navigation Label', 'auto-submenu')}\n\t\t\t\t\t\t\t\t\t\t\t</>}\n\t\t\t\t\t\t\t\t\t\t\tvalue={props.attributes.asm_item_titles ?? '%post_title'}\n\t\t\t\t\t\t\t\t\t\t\tonChange={(newValue) => props.setAttributes({ asm_item_titles: newValue })}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t\t\t{wp.i18n.__('The navigation label may be customized using wildcards such as %post_title. See documentation.', 'auto-submenu')}\n\t\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t: null}\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t: null}\n\t\t\t</>\n\t\t);\n\t};\n}, 'withMyPluginControls');\n\nwp.hooks.addFilter(\n\t'editor.BlockEdit',\n\t'asm/unfold',\n\tasmUnfoldControls\n);\n"],"names":["addFilter","BaseControl","Notice","SelectControl","ToggleControl","TextControl","TextareaControl","createHigherOrderComponent","wp","compose","InspectorControls","blockEditor","PanelBody","PanelRow","components","addASMUnfoldAttribute","settings","attributes","name","Object","assign","type","asmUnfoldControls","BlockEdit","props","_props$attributes$asm","_props$attributes$asm2","createElement","Fragment","key","kind","title","initialOpen","isDismissible","status","i18n","__","id","label","checked","asm_unfold","onChange","newValue","setAttributes","value","asm_item_depth","isNaN","disabled","asm_orderby","options","asm_item_titles","hooks"],"sourceRoot":""}
     1{"version":3,"file":"index.js","mappings":";;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;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,EAAE,CAAC2B,IAAI,CAACC,EAAE,CAAC,UAAU,EAAE,cAAc,CAAE;MAC9CM,KAAK,GAAAjB,qBAAA,GAAED,KAAK,CAACP,UAAU,CAAC6B,WAAW,cAAArB,qBAAA,cAAAA,qBAAA,GAAI,MAAO;MAC9CsB,OAAO,EAAE,CACR;QAAEb,KAAK,EAAE1B,EAAE,CAAC2B,IAAI,CAACC,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC;QAAEM,KAAK,EAAE;MAAa,CAAC,CACvE;MACFH,QAAQ,EAAGC,QAAQ,IAAKhB,KAAK,CAACiB,aAAa,CAAC;QAAEK,WAAW,EAAEN;MAAS,CAAC;IAAE,CACvE,CACW,CAAC,EACdb,oDAAA,CAAC1B,8DAAW,QACX0B,oDAAA,CAACrB,kEAAe;MACf4B,KAAK,EAAEP,oDAAA,CAAAC,2CAAA,QACLpB,EAAE,CAAC2B,IAAI,CAACC,EAAE,CAAC,kBAAkB,EAAE,cAAc,CAC7C,CAAE;MACJM,KAAK,GAAAhB,sBAAA,GAAEF,KAAK,CAACP,UAAU,CAAC+B,eAAe,cAAAtB,sBAAA,cAAAA,sBAAA,GAAI,aAAc;MACzDa,QAAQ,EAAGC,QAAQ,IAAKhB,KAAK,CAACiB,aAAa,CAAC;QAAEO,eAAe,EAAER;MAAS,CAAC;IAAE,CAC3E,CACW,CAAC,EACdb,oDAAA,CAAC1B,8DAAW,QACVO,EAAE,CAAC2B,IAAI,CAACC,EAAE,CAAC,gGAAgG,EAAE,cAAc,CAChH,CACZ,CAAC,GACD,IACO,CACO,CAAC,GAClB,IACF,CAAC;EAEL,CAAC;AACF,CAAC,EAAE,sBAAsB,CAAC;AAE1B5B,EAAE,CAACyC,KAAK,CAACjD,SAAS,CACjB,kBAAkB,EAClB,YAAY,EACZsB,iBACD,CAAC,C","sources":["webpack://asm_core_navigation_link/external window \"React\"","webpack://asm_core_navigation_link/external window [\"wp\",\"components\"]","webpack://asm_core_navigation_link/external window [\"wp\",\"hooks\"]","webpack://asm_core_navigation_link/webpack/bootstrap","webpack://asm_core_navigation_link/webpack/runtime/compat get default export","webpack://asm_core_navigation_link/webpack/runtime/define property getters","webpack://asm_core_navigation_link/webpack/runtime/hasOwnProperty shorthand","webpack://asm_core_navigation_link/webpack/runtime/make namespace object","webpack://asm_core_navigation_link/./src/index.jsx"],"sourcesContent":["module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"hooks\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { addFilter } from '@wordpress/hooks';\nimport { BaseControl, Notice, SelectControl, ToggleControl, TextControl, TextareaControl } from '@wordpress/components'\n\nconst { createHigherOrderComponent } = wp.compose;\nconst { InspectorControls } = wp.blockEditor;\nconst { PanelBody, PanelRow } = wp.components;\n\nfunction addASMUnfoldAttribute(settings) {\n\tif (typeof settings.attributes !== 'undefined') {\n\t\tif (settings.name == 'core/navigation-link') {\n\t\t\tsettings.attributes = Object.assign(settings.attributes, {\n\t\t\t\t'asm_unfold': {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t},\n\t\t\t\t'asm_item_depth': {\n\t\t\t\t\ttype: 'integer',\n\t\t\t\t},\n\t\t\t\t'asm_orderby': {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\t'asm_item_titles': {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'asm/unfold',\n\taddASMUnfoldAttribute\n);\n\nconst asmUnfoldControls = createHigherOrderComponent((BlockEdit) => {\n\treturn (props) => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" {...props} />\n\t\t\t\t{props.attributes.kind === 'post-type' && props.attributes.type === 'page'\n\t\t\t\t\t? <InspectorControls>\n\t\t\t\t\t\t<PanelBody title=\"Auto Submenu\" initialOpen={false}>\n\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tid='asm_unfold'\n\t\t\t\t\t\t\t\t\tkey='asm_unfold'\n\t\t\t\t\t\t\t\t\tlabel={wp.i18n.__('Create submenu containing child pages', 'auto-submenu')}\n\t\t\t\t\t\t\t\t\tchecked={!!props.attributes.asm_unfold}\n\t\t\t\t\t\t\t\t\tonChange={(newValue) => props.setAttributes({ asm_unfold: newValue })}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t{props.attributes.asm_unfold\n\t\t\t\t\t\t\t\t? <>\n\t\t\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={<>\n\t\t\t\t\t\t\t\t\t\t\t\t{wp.i18n.__('Nesting depth', 'auto-submenu')} (max 3)\n\t\t\t\t\t\t\t\t\t\t\t</>}\n\t\t\t\t\t\t\t\t\t\t\tvalue={props.attributes.asm_item_depth > 0 ? props.attributes.asm_item_depth : 3}\n\t\t\t\t\t\t\t\t\t\t\tonChange={(newValue) => props.setAttributes({ asm_item_depth: isNaN(+newValue) || (+newValue) > 3 ? 3 : +newValue })}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t\t\t\t\tlabel={wp.i18n.__('Order by', 'auto-submenu')}\n\t\t\t\t\t\t\t\t\t\t\tvalue={props.attributes.asm_orderby ?? 'none'}\n\t\t\t\t\t\t\t\t\t\t\toptions={[\n\t\t\t\t\t\t\t\t\t\t\t\t{ label: wp.i18n.__('Menu Order', 'auto-submenu'), value: 'menu_order' }\n\t\t\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\t\t\tonChange={(newValue) => props.setAttributes({ asm_orderby: newValue })}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={<>\n\t\t\t\t\t\t\t\t\t\t\t\t{wp.i18n.__('Navigation Label', 'auto-submenu')}\n\t\t\t\t\t\t\t\t\t\t\t</>}\n\t\t\t\t\t\t\t\t\t\t\tvalue={props.attributes.asm_item_titles ?? '%post_title'}\n\t\t\t\t\t\t\t\t\t\t\tonChange={(newValue) => props.setAttributes({ asm_item_titles: newValue })}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t\t\t{wp.i18n.__('The navigation label may be customized using wildcards such as %post_title. See documentation.', 'auto-submenu')}\n\t\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t: null}\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t: null}\n\t\t\t</>\n\t\t);\n\t};\n}, 'withMyPluginControls');\n\nwp.hooks.addFilter(\n\t'editor.BlockEdit',\n\t'asm/unfold',\n\tasmUnfoldControls\n);\n"],"names":["addFilter","BaseControl","Notice","SelectControl","ToggleControl","TextControl","TextareaControl","createHigherOrderComponent","wp","compose","InspectorControls","blockEditor","PanelBody","PanelRow","components","addASMUnfoldAttribute","settings","attributes","name","Object","assign","type","asmUnfoldControls","BlockEdit","props","_props$attributes$asm","_props$attributes$asm2","createElement","Fragment","key","kind","title","initialOpen","id","label","i18n","__","checked","asm_unfold","onChange","newValue","setAttributes","value","asm_item_depth","isNaN","disabled","asm_orderby","options","asm_item_titles","hooks"],"sourceRoot":""}
Note: See TracChangeset for help on using the changeset viewer.