public static function getCMSTitles($location, $id_shop = false) { $content = array(); $context = Context::getContext(); $cmsCategories = OvicBlockCMSModel::getCMSCategoriesByLocation($location, $id_shop); if (is_array($cmsCategories) && count($cmsCategories)) { foreach ($cmsCategories as $cmsCategory) { $key = (int) $cmsCategory['id_cms_block']; $content[$key]['display_store'] = $cmsCategory['display_store']; $content[$key]['cms'] = OvicBlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block'], $id_shop); $links = array(); if (count($content[$key]['cms'])) { foreach ($content[$key]['cms'] as $row) { $row['link'] = $context->link->getCMSLink((int) $row['id_cms'], $row['link_rewrite']); $links[] = $row; } } $content[$key]['cms'] = $links; $content[$key]['categories'] = OvicBlockCMSModel::getCMSBlockPagesCategories($cmsCategory['id_cms_block']); $links = array(); if (count($content[$key]['categories'])) { foreach ($content[$key]['categories'] as $row) { $row['link'] = $context->link->getCMSCategoryLink((int) $row['id_cms'], $row['link_rewrite']); $links[] = $row; } } $content[$key]['categories'] = $links; $content[$key]['name'] = $cmsCategory['block_name']; $content[$key]['category_link'] = $context->link->getCMSCategoryLink((int) $cmsCategory['id_cms_category'], $cmsCategory['link_rewrite']); $content[$key]['category_name'] = $cmsCategory['category_name']; } } return $content; }