src/CoreBundle/Contao/Hooks/RegisterBackendNavigation.php
public function onGetUserNavigation($modules)
    {
        if (null === $request = $this->requestStack->getCurrentRequest()) {
            return $modules;
        }
        $this->addBackendCss();

        if (null !== ($user = $this->tokenStorage->getToken())) {
            $userRights = $this->extractUserRights($user);
        }
        $isAdmin = \in_array('ROLE_ADMIN', array_map(function (Role $role) {
            return $role->getRole();
        }, $user->getRoles()), true);

        if ($isAdmin || isset($userRights['support_metamodels'])) {
            $this->addMenu(
                $modules,
                'metamodels',
                'support_screen',
                [
                    'label' => $this->translator->trans('MOD.support_metamodels.0', [], 'contao_modules'),
                    'title' => $this->translator->trans('MOD.support_metamodels.1', [], 'contao_modules'),
                    'route' => 'metamodels.support_screen',
                    'param' => [],
                ],
                $request
            );
        }

        $locale = $request->getLocale();
        foreach ($this->viewCombination->getStandalone() as $metaModelName => $screen) {
            $moduleName = 'metamodel_' . $metaModelName;
            if (!$isAdmin && !isset($userRights[$moduleName])) {
                continue;
            }
            $this->addMenu(
                $modules,
                $screen['meta']['backendsection'],
                $moduleName,
                [
                    'label' => $this->extractLanguageValue($screen['label'], $locale),
                    'title' => $this->extractLanguageValue($screen['description'], $locale),
                    'route' => 'contao_backend',
                    'param' => ['do' => 'metamodel_' . $metaModelName],
                ],
                $request
            );
        }

        return $modules;
    }
public function onGetUserNavigation($modules)
    {
        if (null === $request = $this->requestStack->getCurrentRequest()) {
            return $modules;
        }
        $this->addBackendCss();

        if (null !== ($user = $this->tokenStorage->getToken())) {
            $userRights = $this->extractUserRights($user);
        }
        $isAdmin = \in_array('ROLE_ADMIN', array_map(function (Role $role) {
            return $role->getRole();
        }, $user->getRoles()), true);

        if ($isAdmin || isset($userRights['support_metamodels'])) {
            $this->addMenu(
                $modules,
                'metamodels',
                'support_screen',
                [
                    'label' => $this->translator->trans('MOD.support_metamodels.0', [], 'contao_modules'),
                    'title' => $this->translator->trans('MOD.support_metamodels.1', [], 'contao_modules'),
                    'route' => 'metamodels.support_screen',
                    'param' => [],
                ],
                $request
            );
        }

        $locale = $request->getLocale();
        foreach ($this->viewCombination->getStandalone() as $metaModelName => $screen) {
            $moduleName = 'metamodel_' . $metaModelName;
            if (!$isAdmin && !isset($userRights[$moduleName])) {
                continue;
            }
            $this->addMenu(
                $modules,
                $screen['meta']['backendsection'],
                $moduleName,
                [
                    'label' => $this->extractLanguageValue($screen['label'], $locale),
                    'title' => $this->extractLanguageValue($screen['description'], $locale),
                    'route' => 'contao_backend',
                    'param' => ['do' => 'metamodel_' . $metaModelName],
                ],
                $request
            );
        }

        return $modules;
    }
Hook function

@param array $modules The backend navigation.

@return array