Skip to content

Setup: Modules configuration

dante di domenico edited this page May 3, 2023 · 14 revisions

Edit configuration

[this guide refers to version 3.4.3 and above]

Modules configuration can be customized providing a Modules configuration in config/app_local.php (or in config/projects/<projectName>.php if you use multi project configuration).

You can also override it directly in your BEdita Manager, at Admin -> Appearence page, in json format.

Keys must be actual API endpoint names like documents, users or folders. Modules order will follow key order of this configuration. In case of core or plugin modules not directly served by ModulesController (generally modules not related to object types) a 'route' attribute can be specified for custom controller and action rules.

Array value may contain:

  • 'label' - module label to display, if not set key will be used
  • 'shortLabel' - short label, 3 character recommended
  • 'color' - primary color code
  • 'secondaryColor' - secondary color code
  • 'route' - custom route (named route or absolute/relative URL) used by plugin modules mainly
  • 'sort' - sort order to be used in index; use a field name prepending optionl - sign to indicate a descendant order, f.i. '-title' will sort by title in reverse alphabetical order (default is '-id')
  • 'icon' - icon code, f.i. icon-article, have a look in webroot/css/be-icons-codes.css for a complete list of codes
  • 'sidebar' - additional custom sidebar links added in modules index and single item view, defined as associative array or JSON object (see below for details)
  • 'categories' - customize categories section in module view

Example for php file:

'Modules' => [
    'planets' => [
        'label' => 'Our Planets',
        'shortLabel' => 'pls',
        'color' => '#230637',
        'secondaryColor' => '#d95700',
        'route' => 'my-plugin::planets-list',
        'sort' => '-modified',
        'icon' => 'icon-cube',
        'sidebar' => [
          'index' => [
            [
              'label' => 'Custom Label',
              'url' => ['_name': 'custom:name'], // URL can be a named URL array
            ],
          ],
          'view' => [
            [
              'label' => 'Custom Label',
              'url' => '/custom-url', // URL can be a relative path or absolute URL
            ],
          ],
          '_element' => 'Modules/my_custom_planets_sidebar', // custom twig template, can be in a plugin too
        ],
        'categories' => [
          '_element' => 'Modules/my_custom_planets_categories', // custom twig template, can be in a plugin too
        ],
    ],
],

Example for json (Admin -> Appearence):

{
  "planets": {
    "label": "Our Planets",
    "shortLabel": "pls",
    "color": "#230637",
    "secondaryColor": "#d95700",
    "route": "my-plugin::planets-list",
    "sort": "-modified",
    "icon": "icon-cube",
    "sidebar": {
      "index": [
        {
          "label": "Custom Label",
          "url": {
            "_name": "custom:name"
          }
        }
      ],
      "view": [
        {
          "label": "Custom Label2",
          "url": "/custom-url"
        }
      ],
      "_element": "Modules/my_custom_planets_sidebar"
    },
    "categories": {
      "_element": "Modules/my_custom_planets_categories"
    }
  }
}

Custom urls in sidebar.view are populated with the current object id, with this rule:

  • in case of relative or absolute string url a /{id} suffix is added with the current object id
  • in case of named route and item id: {id} or 'id' => {id} is added to the name route via merge
Clone this wiki locally