protected function updatePositionsDnd() { if (Tools::getValue('cms_block_0')) { $positions = Tools::getValue('cms_block_0'); } elseif (Tools::getValue('cms_block_1')) { $positions = Tools::getValue('cms_block_1'); } else { $positions = array(); } foreach ($positions as $position => $value) { $pos = explode('_', $value); if (isset($pos[2])) { BlockCMSModel::updateCMSBlockPosition($pos[2], $position); } } }
public static function getCMSTitles($location, $id_shop = false) { $content = array(); $context = Context::getContext(); $cmsCategories = BlockCMSModel::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'] = BlockCMSModel::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'] = BlockCMSModel::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; }