1. Go to this page and download the library: Download maikschneider/category-tree 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/ */
maikschneider / category-tree example snippets
return [
'myext_reports' => [
'parent' => 'web',
'access' => 'user',
'labels' => 'LLL:EXT:my_ext/Resources/Private/Language/locallang_mod.xlf',
// Required: the parent module ships the page tree, and submodules inherit it
// unless inheritance is switched off. Without this you get the page tree.
'inheritNavigationComponentFromMainModule' => false,
'navigationComponent' => '@maikschneider/category-tree/category-tree-element',
'routes' => [
'_default' => [
'target' => \Vendor\MyExt\Controller\ReportController::class . '::handleRequest',
],
],
],
];
public function handleRequest(ServerRequestInterface $request): ResponseInterface
{
$categoryUid = (int)($request->getQueryParams()['category'] ?? 0);
// 0 means "no category selected" — the tree's root node clears the parameter.
}