x\panel\type()

Standard control panel definition.

Table of Contents
  1. Description
  2. Example

Description

x\panel\type(array $_ = []): array;

Returns the standard control panel definition with no file system interaction.

Example

test(x\panel\type());
Default

You can pass your own custom definition data to the function call. It will be combined with the standard control panel definition data returned by this function. This is usually done when you want to start interacting with the file system, so the control panel definition data returned will be dynamic:

$lot = [];

for ($i = 1; $i < 4; ++$i) {
    $lot['folder-' . $i] = [
        'icon' => 'M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z',
        'title' => 'Folder ' . $i,
        'url' => [
            'hash' => null,
            'part' => 1,
            'path' => 'folder-' . $i,
            'query' => [],
            'task' => 'get'
        ]
    ];
}

test(x\panel\type([
    'lot' => [
        'bar' => [
            'lot' => [
                0 => [
                    'lot' => [
                        'folder' => [
                            'lot' => $lot
                        ]
                    ]
                ]
            ]
        ]
    ]
]));
Example: Adding Menus

However, a manual function call, as in the example above, has never been performed by this application since the definition will be created automatically based on the value of the type variable:

// This will call `x\panel\type\page()` or `x\panel\type(['type' => 'page'])` and load its result into the `$_['lot']` variable.
$_['type'] = 'page';

// This will call `x\panel\type\page\page()` or `x\panel\type(['type' => 'page/page'])` and load its result into the `$_['lot']` variable.
$_['type'] = 'page/page';