PHP code example of webcoast / editable-menus

1. Go to this page and download the library: Download webcoast/editable-menus library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webcoast / editable-menus example snippets




return [
    'the_menu_identifier' => [
        // The menu configuration
    ],
    // ... more menu configurations
];



return [
    'header' => [], // This creates a field called `header_menu` in the root page properties
];



return [
    'header' => [
        'label' => 'My menu label', // Explicitly define a label, can also be a LLL reference
        'description' => 'A description explaining the usage of this menu', // Explicitly define a description, can also be a LLL reference
        'exclude' => false, // Do not make the menu field an exclude field, defaults to true if not defined (null)
        'displayCond' => 'FIELD:is_siteroot:=:1', // Define the display condition of this field. Supports all valid displayCond values. Defaults to `FIELD:is_siteroot:=:1`
        'levels' => 2, // Number of levels for the menu rendering in TypoScript. Defaults to `1`
        'disabled' => true, // Defaults to false, used to disable previously defined menus
    ],
];



return [
    'header' => [
        // Add custom label and description for field `header_menu`
        'label' => 'LLL:EXT:sitepackage/Resources/Private/Language/Menus.xlf:header.label',
        'description' => 'LLL:EXT:sitepackage/Resources/Private/Language/Menus.xlf:header.description',
    ],
    'footer' => [
        // Disable the footer menu, meaning the field is not shown in the backend and the SQL for the database column would not be generated
        'disabled' => true,
    ],
];