/** * @param array $component The parent menu node * @param array $items The menu items to output * @param bool $disabled If the menu item should be disabled (grayed) * @param int $depth The depth of the menu items * @return null|string */ private static function getTabItems($component, $items, $disabled = false, $depth = 0) { $parentTitleCleanHtml = isset($component['title']) ? $component['title'] : null; $parentAccess = isset($component['access']) ? $component['access'] : null; $return = null; if ($parentTitleCleanHtml && modCBAdminHelper::checkAccess($parentAccess)) { if (!$disabled) { if (!$depth) { $return .= '<thead>' . '<tr>' . '<th>' . $parentTitleCleanHtml . '</th>' . '</tr>' . '</thead>'; } if ($items) { if (!$depth) { $return .= '<tbody>'; } foreach ($items as $item) { $title = isset($item['title']) ? $item['title'] : null; $link = isset($item['link']) ? $item['link'] : null; $access = isset($item['access']) ? $item['access'] : null; $target = isset($item['target']) ? $item['target'] : null; $subMenu = isset($item['submenu']) ? $item['submenu'] : array(); if ($title && $link && modCBAdminHelper::checkAccess($access)) { $return .= '<tr>' . '<td>' . ($depth ? str_repeat('<span class="fa fa-angle-right text-muted"></span> ', $depth) : null) . '<a href="' . htmlspecialchars($link) . '"' . ($target ? ' target="' . htmlspecialchars($target) . '"' : null) . '>' . $title . '</a>' . '</td>' . '</tr>'; if ($subMenu) { $return .= $subMenu ? modCBAdminHelper::getTabItems($item, $subMenu, false, $depth + 1) : null; } } } if (!$depth) { $return .= '</tbody>'; } } } elseif (!$depth) { $return .= '<thead>' . '<tr class="active text-muted">' . '<th>' . $parentTitleCleanHtml . '</th>' . '</tr>' . '</thead>'; } } return $return; }