/**
  * Get the column class name for the specified index
  *
  * @param  int    $index Index of the column
  * @return string        Class name(s)
  */
 public function getColumnClassName($index)
 {
     if (!class_exists('MadeYourDay\\Contao\\Element\\ColumnsStart')) {
         return '';
     }
     $config = ColumnsStart::getColumnsConfiguration($this->arrData);
     $classes = array('rs-column');
     foreach ($config as $name => $media) {
         $classes = array_merge($classes, $media[$index % count($media)]);
         if ($index < count($media)) {
             $classes[] = '-' . $name . '-first-row';
         }
     }
     return implode(' ', $classes);
 }
 protected function renderNavigation($pid, $level = 1, $host = null, $language = null)
 {
     $parentPage = PageModel::findByPk($pid);
     if (!$parentPage->rsmm_enabled || !$parentPage->rsmm_id) {
         return parent::renderNavigation($pid, $level, $host, $language);
     }
     $menu = MenuModel::findByPk($parentPage->rsmm_id);
     if (!$menu || !$menu->id) {
         return '';
     }
     $template = new FrontendTemplate($this->rsmm_template);
     $template->id = $menu->id;
     $template->type = $menu->type;
     $template->cssClass = $menu->cssClass;
     $template->cssId = $menu->cssId;
     $template->level = 'level_' . ($level + 1);
     $template->html = $menu->html;
     $template->backgroundImage = $this->getImageObject($menu->backgroundImage, $menu->backgroundImageSize);
     $template->backgroundStyle = '';
     if ($template->backgroundImage) {
         $template->backgroundStyle .= 'background-image: url(&quot;' . $template->backgroundImage->src . '&quot;);';
     }
     if ($menu->backgroundSize) {
         $template->backgroundStyle .= 'background-size: ' . $menu->backgroundSize . ';';
     }
     if ($menu->backgroundPosition) {
         $template->backgroundStyle .= 'background-position: ' . $menu->backgroundPosition . ';';
     }
     if ($menu->backgroundRepeat) {
         $template->backgroundStyle .= 'background-repeat: ' . $menu->backgroundRepeat . ';';
     }
     $sliderAssetsDir = version_compare(VERSION, '4.0', '>=') ? 'web/bundles/rocksolidslider' : 'system/modules/rocksolid-slider/assets';
     if ($menu->slider && file_exists(TL_ROOT . '/' . $sliderAssetsDir . '/js/rocksolid-slider.min.js')) {
         $template->slider = true;
         $options = array('navType' => $menu->sliderNavType, 'controls' => $menu->sliderControls, 'gapSize' => $menu->sliderGapSize, 'skin' => $menu->sliderSkin ?: 'mega-dropdown', 'loop' => (bool) $menu->sliderLoop, 'keyboard' => false);
         if ($menu->sliderMaxCount) {
             $options['slideMaxCount'] = (int) $menu->sliderMaxCount;
         }
         if ($menu->sliderMinSize) {
             $options['slideMinSize'] = (int) $menu->sliderMinSize;
         }
         if ($menu->sliderPrevNextSteps) {
             $options['prevNextSteps'] = (int) $menu->sliderPrevNextSteps;
         }
         $template->sliderOptions = $options;
         $GLOBALS['TL_JAVASCRIPT'][] = $sliderAssetsDir . '/js/rocksolid-slider.min.js|static';
         $GLOBALS['TL_CSS'][] = $sliderAssetsDir . '/css/rocksolid-slider.min.css||static';
         $template->getColumnClassName = function () {
             return '';
         };
     } else {
         $columnsConfig = ColumnsStart::getColumnsConfiguration($menu->row());
         $template->getColumnClassName = function ($index) use($columnsConfig) {
             $classes = array('rs-column');
             foreach ($columnsConfig as $name => $media) {
                 $classes = array_merge($classes, $media[$index % count($media)]);
                 if ($index < count($media)) {
                     $classes[] = '-' . $name . '-first-row';
                 }
             }
             return implode(' ', $classes);
         };
     }
     if ($menu->type === 'manual') {
         $menuColumns = MenuColumnModel::findPublishedByPid($menu->id);
         if (!$menuColumns) {
             return '';
         }
         $columns = array();
         while ($menuColumns->next()) {
             $column = $menuColumns->row();
             if ($column['page']) {
                 $pageResult = PageModel::findPublishedById($column['page']);
                 if ($pageResult) {
                     $column['page'] = $this->getPageData($pageResult, $column['imageSize']);
                 } else {
                     $column['page'] = null;
                 }
             }
             $column['image'] = $this->getImageObject($column['image'], $column['imageSize']);
             if ($column['type'] === 'manual' || $column['type'] === 'manual_image') {
                 $column['pages'] = $this->buildPagesArray($column['pages'], $column['imageSize'], $column['orderPages']);
             } else {
                 if ($column['type'] === 'auto' || $column['type'] === 'auto_image') {
                     $column['pages'] = $this->buildPagesArray($column['page'], $column['imageSize']);
                 } else {
                     $column['pages'] = null;
                 }
             }
             $columns[] = $column;
         }
         $template->columns = $columns;
     } else {
         if ($menu->type !== 'html') {
             $template->pages = $this->buildPagesArray($pid, $menu->imageSize);
         }
     }
     return $template->parse();
 }