private function renderTeaserList($renderApi, $unit) { $startPage = $renderApi->getFormValue($unit, 'teaserStartPage'); $enableRecursive = $renderApi->getFormValue($unit, 'enableRecursive'); $teaserItems = $this->getTeaserItemsRecursive($renderApi, $startPage, $enableRecursive); // sorting $teaserItems = $this->sortTeaserItems($renderApi, $unit, $teaserItems); // limit $teaserItems = $this->limitTeaserItems($renderApi, $unit, $teaserItems); $listItemTag = new HtmlTagBuilder('li', array('class' => 'teaserItem')); // TODO find better solution to communicate with rz_page_property global $currentTeaserPageId; if (count($teaserItems) === 0 && $renderApi->isEditMode()) { echo $listItemTag->getOpenString(); $renderApi->renderChildren($unit); echo $listItemTag->getCloseString(); } else { foreach ($teaserItems as $item) { $currentTeaserPageId = $item['pageId']; echo $listItemTag->getOpenString(); $renderApi->renderChildren($unit); echo $listItemTag->getCloseString(); // show only one page due to multiple unit id problem if ($renderApi->isEditMode()) { break; } } // TODO fill teaser placeholders //echo '<div class="RUKZUKmissingInputHint"><button style="cursor: default;">(Teaser ' . ($iTeaserItemPos + 1) . ')</button></div>'; } $currentTeaserPageId = null; }
protected function renderContent($renderApi, $unit, $moduleInfo) { $elementsTag = new HtmlTagBuilder('div', array('class' => 'cntElements')); echo $elementsTag->getOpenString(); // find all children modules $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; } } // wrap all children $wrapTag = new HtmlTagBuilder('div'); for ($i = 0; $i < count($renderItems); $i++) { echo $wrapTag->getOpenString(); $renderApi->renderUnit($renderItems[$i]); echo $wrapTag->getCloseString(); } echo $elementsTag->getCloseString(); // needed for vertical alignment when container is higher than contained children $fillHeightTag = new HtmlTagBuilder('div', array('class' => 'fillHeight')); echo $fillHeightTag->toString(); }
public function renderContent($renderApi, $unit, $moduleInfo) { // find all children modules $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; } } // wrap all children if (empty($renderItems)) { if ($renderApi->isEditMode() && $renderApi->isTemplate()) { $i18n = new Translator($renderApi, $moduleInfo); $msg = $i18n->translate('msg.emptyInEditMode'); $errorTag = new HtmlTagBuilder('div', array('class' => 'RUKZUKmissingInputHint'), array(new HtmlTagBuilder('button', array('style' => 'cursor: default;'), array($msg)))); echo $errorTag->toString(); } } else { $wrapTag = new HtmlTagBuilder('div'); foreach ($renderItems as $renderItem) { echo $wrapTag->getOpenString(); $renderApi->renderUnit($renderItem); echo $wrapTag->getCloseString(); } } }
/** * @param $renderApi * @param \Render\Unit $unit * @param Array $tabTitles */ protected function renderTabContent($renderApi, $unit, $tabTitles) { // get all children which are no extensions $children = array(); foreach ($renderApi->getChildren($unit) as $childUnit) { if (!$renderApi->getModuleInfo($childUnit)->isExtension()) { $children[] = $childUnit; } } $tabsWrapper = new HtmlTagBuilder('div', array('class' => 'tabsWrapper')); echo $tabsWrapper->getOpenString(); $tabCount = 0; foreach ($tabTitles as $tabTitle) { $tabWrapper = new HtmlTagBuilder('section', array('class' => 'tabContent')); echo $tabWrapper->getOpenString(); $tabId = $unit->getId() . '_tab' . $tabCount; $label = new HtmlTagBuilder('label', array('for' => $tabId, 'class' => 'tabLabel'), array(new HtmlTagBuilder('h2', null, $tabTitle))); echo $label->toString(); if (!empty($children[$tabCount])) { $contentWrapper = new HtmlTagBuilder('div'); echo $contentWrapper->getOpenString(); $renderApi->renderUnit($children[$tabCount]); echo $contentWrapper->getCloseString(); } echo $tabWrapper->getCloseString(); $tabCount++; } echo $tabsWrapper->getCloseString(); }
protected function renderContent($api, $unit, $moduleInfo) { $handlePos = $api->getFormValue($unit, 'handlePosition'); $handle = $this->getHandleCode($api, $unit); if ($handlePos == 'top') { echo $handle; } $contentTag = new HtmlTagBuilder('div', array('class' => 'collapsibleContent')); echo $contentTag->getOpenString(); $api->renderChildren($unit); $this->insertMissingInputHint($api, $unit); /* TODO only working in page mode? */ echo $contentTag->getCloseString(); if ($handlePos == 'bottom') { echo $handle; } }
protected function renderContent($renderApi, $unit, $moduleInfo) { // find all children modules $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; } } // wrap all children $wrapTag = new HtmlTagBuilder('div'); echo $wrapTag->getOpenString(); for ($i = 0; $i < count($renderItems); $i++) { $renderApi->renderUnit($renderItems[$i]); } echo $wrapTag->getCloseString(); }