private function makeMenu()
 {
     $menu = '';
     $menu_items = $this->getMenuItems();
     $id_lang = (int) $this->context->language->id;
     $id_shop = (int) Shop::getContextShopID();
     $head = $this->_itemHead;
     $tail = $this->_itemTail;
     foreach ($menu_items as $item) {
         if (!$item) {
             continue;
         }
         preg_match($this->pattern, $item, $value);
         $id = (int) substr($item, strlen($value[1]), strlen($item));
         switch (substr($item, 0, strlen($value[1]))) {
             case 'CAT':
                 $this->getCategory($menu, (int) $id);
                 break;
             case 'PRD':
                 $selected = $this->page_name == 'product' && Tools::getValue('id_product') == $id ? ' active' : '';
                 $product = new Product((int) $id, true, (int) $id_lang);
                 if (!is_null($product->id)) {
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $product->getLink() . '"><span>' . $product->name . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'CMS':
                 $selected = $this->page_name == 'cms' && Tools::getValue('id_cms') == $id ? ' active' : '';
                 $cms = CMS::getLinks((int) $id_lang, array($id));
                 if (count($cms)) {
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $cms[0]['link'] . '"><span>' . $cms[0]['meta_title'] . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'CMS_CAT':
                 $category = new CMSCategory((int) $id, (int) $id_lang);
                 if (count($category)) {
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $category->getLink() . '"><span>' . $category->name . '</span></a>';
                     $this->getCMSMenuItems($menu, $category->id);
                     $menu .= '</li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'MAN':
                 $selected = $this->page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id ? ' active' : '';
                 $manufacturer = new Manufacturer((int) $id, (int) $id_lang);
                 if (!is_null($manufacturer->id)) {
                     if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
                         $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name, false);
                     } else {
                         $manufacturer->link_rewrite = 0;
                     }
                     $link = new Link();
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $link->getManufacturerLink((int) $id, $manufacturer->link_rewrite) . '"><span>' . $manufacturer->name . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'SUP':
                 $selected = $this->page_name == 'supplier' && Tools::getValue('id_supplier') == $id ? ' active' : '';
                 $supplier = new Supplier((int) $id, (int) $id_lang);
                 if (!is_null($supplier->id)) {
                     $link = new Link();
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $link->getSupplierLink((int) $id, $supplier->link_rewrite) . '"><span>' . $supplier->name . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'SHOP':
                 $selected = $this->page_name == 'index' && $this->context->shop->id == $id ? ' active' : '';
                 $shop = new Shop((int) $id);
                 if (Validate::isLoadedObject($shop)) {
                     $link = new Link();
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $shop->getBaseURL() . '"><span>' . $shop->name . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'LNK':
                 $link = MenuTopLinks_mod::get((int) $id, (int) $id_lang, (int) $id_shop);
                 if (count($link)) {
                     if (!isset($link[0]['label']) || $link[0]['label'] == '') {
                         $default_language = Configuration::get('PS_LANG_DEFAULT');
                         $link = MenuTopLinks_mod::get($link[0]['id_linksmenutop'], $default_language, (int) Shop::getContextShopID());
                     }
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $link[0]['link'] . '"' . ($link[0]['new_window'] ? ' target="_blank"' : '') . '><span>' . $link[0]['label'] . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
         }
     }
     return $menu;
 }
 public function renderList()
 {
     $links = MenuTopLinks_mod::gets((int) $this->context->language->id, null, (int) Shop::getContextShopID());
     $fields_list = array('id_linksmenutop' => array('title' => $this->l('Link ID'), 'type' => 'text'), 'label' => array('title' => $this->l('Label'), 'type' => 'text'), 'link' => array('title' => $this->l('Link'), 'type' => 'link'), 'new_window' => array('title' => $this->l('New window'), 'type' => 'bool', 'align' => 'center', 'active' => 'status'));
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = true;
     $helper->identifier = 'id_linksmenutop';
     $helper->table = 'linksmenutop';
     $helper->actions = array('edit', 'delete');
     $helper->show_toolbar = false;
     $helper->module = $this;
     $helper->title = $this->l('Link list');
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     return $helper->generateList($links, $fields_list);
 }