Networking\InitCmsBundle\Controller\HelpTextController::adminGetHelpTextNavigation PHP Method

adminGetHelpTextNavigation() protected method

Create the navigation for the help text view
protected adminGetHelpTextNavigation ( array $dashBoardGroups, $locale, $helpTextManager ) : array
$dashBoardGroups array
$locale
$helpTextManager
return array
    protected function adminGetHelpTextNavigation(array $dashBoardGroups, $locale, $helpTextManager)
    {
        $navArray = array();
        //add overview & dashboard manually
        $navArray['overview']['group_name'] = $this->get('translator')->trans('title.help', array(), 'HelpTextAdmin');
        $navArray['overview']['group_items']['0']['adminCode'] = 'overview';
        $navArray['overview']['group_items']['0']['action'] = '';
        $navArray['overview']['group_items']['0']['title'] = $this->get('translator')->trans('overview.title', array(), 'HelpTextAdmin');
        $navArray['dashboard']['group_name'] = 'Dashboard';
        $navArray['dashboard']['group_items']['0']['adminCode'] = 'dashboard';
        $navArray['dashboard']['group_items']['0']['action'] = '';
        $navArray['dashboard']['group_items']['0']['title'] = $this->get('translator')->trans('dashboard.title', array(), 'HelpTextAdmin');
        foreach ($dashBoardGroups as $key => $group) {
            foreach ($group['sub_group'] as $subGroup) {
                $navArray[$subGroup['label']]['group_items'] = array();
                $i = 0;
                foreach ($subGroup['items'] as $admin) {
                    if (0 == $i++) {
                        $navArray[$subGroup['label']]['group_name'] = $this->get('translator')->trans($subGroup['label'], array(), $admin->getTranslationDomain());
                    }
                    $help_text_result = $helpTextManager->searchHelpTextByKeyLocale($admin->getCode(), $locale);
                    if (count($help_text_result) > 0) {
                        foreach ($help_text_result as $row) {
                            //split Translation Key into adminCode and action
                            $strripos = strripos($row->getTranslationKey(), '.');
                            $action = substr($row->getTranslationKey(), $strripos + 1);
                            $navArray[$subGroup['label']]['group_items'][$row->getId()]['adminCode'] = $admin->getCode();
                            $navArray[$subGroup['label']]['group_items'][$row->getId()]['action'] = $action;
                            $navArray[$subGroup['label']]['group_items'][$row->getId()]['title'] = $row->getTitle();
                        }
                    }
                }
            }
        }
        return $navArray;
    }