/** * @param \Render\APIs\APIv1\RenderAPI $renderApi * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ public function render($renderApi, $unit, $moduleInfo) { $classes = array($moduleInfo->getId(), 'isModule', 'isColumnBox', htmlspecialchars($unit->getHtmlClass(), ENT_QUOTES, 'UTF-8')); // show add module button in page mode if this is a ghost container if ($renderApi->isEditMode() && $renderApi->isPage() && $unit->isGhostContainer()) { $classes[] = 'showAddModuleButton'; } // Dimensions, Grid, Responsive-Settings $i = 0; $resolutions = $renderApi->getResolutions(); $childWidth = $this->getResponsiveValue($unit, 'cssChildWidth', $renderApi); $maxCols = 0; $cols = array(); foreach ($childWidth as $widths) { $col = count(explode(' ', trim($widths['value']))); $cols[] = $col; if ($col > $maxCols) { $maxCols = $col; } } $allItems = $renderApi->getChildren($unit); $renderItems = array(); // normal units $nonRenderItems = array(); // extension units foreach ($allItems as $item) { if ($renderApi->getModuleInfo($item)->isExtension()) { // assume that extension modules (i.e. styles) render no html output $nonRenderItems[] = $item; } else { $renderItems[] = $item; } } $counter = max($maxCols, count($renderItems)); $unitId = $unit->getId(); $classesStr = implode(' ', $classes); echo "<div id='{$unitId}' class='{$classesStr}'><div class='isColumnBoxTable wkFixTableLayout'>"; for ($i = 0; $i < $counter; $i++) { if (array_key_exists($i, $renderItems)) { // cell has an item echo '<div class="isColumnBoxCell">'; $renderApi->renderUnit($renderItems[$i]); echo '</div>'; if ($i === count($renderItems) - 1) { echo '<div class="boxSpacer boxSpacerLast"></div>'; } else { echo '<div class="boxSpacer"></div>'; } } else { // empty cell echo '<div class="boxPreview isColumnBoxCell">'; if ($renderApi->isEditMode()) { echo '<div class="RUKZUKemptyBox"></div>'; } echo '</div>'; echo '<div class="boxSpacer boxPreviewSpacer"></div>'; } } echo '</div></div>'; }
/** * @param \Render\APIs\APIv1\HeadAPI $api * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo * * @return array */ public function provideUnitData($api, $unit, $moduleInfo) { return array('method' => __METHOD__, 'module' => $moduleInfo->getId(), 'unit' => $unit->getId()); }
/** * DynCSS Plugin * @param \Render\ModuleInfo $moduleInfo * @return array */ private function getDynCSSPlugin($moduleInfo) { if (!isset($this->_dynCssPlugin)) { // look for a dynCSS file (this can be in an extension/style as well as an ordinary module) $dynCssFile = 'notlive/css.js'; $dynCssAssetPath = $moduleInfo->getAssetPath($dynCssFile); if (is_file($dynCssAssetPath)) { $result = array(); $result['path'] = $dynCssAssetPath; $result['url'] = $moduleInfo->getAssetUrl($dynCssFile); $result['name'] = $moduleInfo->getId(); $result['mtime'] = filemtime($dynCssAssetPath); } else { $result = null; } $this->_dynCssPlugin = $result; } return $this->_dynCssPlugin; }