/** * @param HtmlTagBuilder $tag * @param \Render\APIs\APIv1\RenderAPI $renderApi * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ protected function modifyWrapperTag($tag, $renderApi, $unit, $moduleInfo) { // use a only if not in edit mode (to be able to use inline editor) if (!$renderApi->isEditMode()) { $tag->setTagName('a'); $tag->set('href', $this->geturl($renderApi, $unit)); if ($renderApi->getFormValue($unit, 'openNewWindow')) { $tag->set('target', '_blank'); } } // add title $linkTitle = $renderApi->getFormValue($unit, 'linkTitle'); if (!empty($linkTitle)) { $tag->set('title', $linkTitle); } // add active/current classes when linking to internal page if ($renderApi->getFormValue($unit, 'linkType') == 'page') { $pageId = $renderApi->getFormValue($unit, 'pageId'); if (!empty($pageId)) { $nav = $renderApi->getNavigation(); $navIds = $this->getNavigatorIds($nav); if ($this->isPageActive($pageId, $navIds)) { $tag->addClass('linkPageActive'); } if ($pageId == $nav->getCurrentPageId()) { $tag->addClass('linkPageCurrent'); } } } }
/** * @param HtmlTagBuilder $tag * @param \Render\APIs\APIv1\RenderAPI $api * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ public function modifyWrapperTag($tag, $api, $unit, $moduleInfo) { $sliderConfig = array('mode' => $api->getFormValue($unit, 'sliderMode'), 'speed' => $api->getFormValue($unit, 'sliderSpeed') ? (int) str_replace('ms', '', $api->getFormValue($unit, 'sliderSpeed')) : 500, 'controls' => $api->getFormValue($unit, 'enableDirectionNav') ? true : false, 'pager' => $api->getFormValue($unit, 'enableControlNav') ? true : false, 'adaptiveHeight' => $api->getFormValue($unit, 'enableSmoothHeight') ? true : false, 'auto' => $api->getFormValue($unit, 'enableSlideshow') && !$api->isEditMode() ? true : false, 'autoHover' => $api->getFormValue($unit, 'enableAutoStopOnHover') ? true : false, 'pause' => (int) str_replace('s', '', $api->getFormValue($unit, 'slideshowSpeed')) * 1000, 'infiniteLoop' => $api->getFormValue($unit, 'enableInfiniteLoop') && !$api->isEditMode() ? true : false, 'hideControlOnEnd' => !$api->getFormValue($unit, 'enableInfiniteLoop'), 'nextText' => '', 'prevText' => '', 'slideSelector' => 'li.slide', 'unitId' => $unit->getId(), 'useCSS' => $api->isEditMode(), 'keyboardEnabled' => $api->getFormValue($unit, 'enableKeyboard') && !$api->isEditMode() ? true : false); $startSlide = $api->getFormValue($unit, 'startSlide'); if ($startSlide === 'random') { $sliderConfig['randomStart'] = true; } else { $sliderConfig['startSlide'] = (int) $startSlide - 1; } $tag->set('data-sliderconfig', json_encode($sliderConfig, JSON_HEX_APOS)); }
/** * @param HtmlTagBuilder $tag * @param \Render\APIs\APIv1\RenderAPI $renderApi * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ protected function modifyWrapperTag($tag, $renderApi, $unit, $moduleInfo) { // use a only if not in edit mode (to be able to use inline editor) if (!$renderApi->isEditMode()) { $tag->setTagName('a'); $tag->set('href', $this->geturl($renderApi, $unit)); if ($renderApi->getFormValue($unit, 'openNewWindow')) { $tag->set('target', '_blank'); } } // add title $linkTitle = $renderApi->getFormValue($unit, 'linkTitle'); if (!empty($linkTitle)) { $tag->set('title', $linkTitle); } // add active/current classes when linking to internal page if ($renderApi->getFormValue($unit, 'linkType') == 'page') { $pageId = $renderApi->getFormValue($unit, 'pageId'); if (!empty($pageId)) { $nav = $renderApi->getNavigation(); $navIds = $this->getNavigatorIds($nav); if ($this->isPageActive($pageId, $navIds)) { $tag->addClass('linkPageActive'); } if ($pageId == $nav->getCurrentPageId()) { $tag->addClass('linkPageCurrent'); } } } // anchor if ($renderApi->getFormValue($unit, 'linkType') == 'anchor' && !$renderApi->isEditMode()) { $jsCode = "\$.scrollTo('" . $renderApi->getFormValue($unit, 'anchorId') . "', " . intval($renderApi->getFormValue($unit, 'scrollSpeed')) . ", {"; $jsCode .= "easing: 'swing',axis: 'y'}); return false;"; $tag->set('onclick', $jsCode); } }
/** * @param \Render\APIs\APIv1\RenderAPI $renderApi * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ public function renderContent($renderApi, $unit, $moduleInfo) { $imgClass = ''; $svgUrl = $moduleInfo->getAssetUrl('imageBlank.svg'); $svgMedia = $renderApi->getFormValue($unit, 'svg'); if ($svgMedia == '') { $imgClass = 'blankImgPlaceholder'; } else { try { $svgUrl = $renderApi->getMediaItem($svgMedia)->getUrl(); } catch (\Exception $e) { } } $svgImgTag = new HtmlTagBuilder('img', array('src' => $svgUrl, 'alt' => $renderApi->getFormValue($unit, 'svgAlt'))); if (!empty($imgClass)) { $svgImgTag->set('class', $imgClass); } $svgTitle = $renderApi->getFormValue($unit, 'svgTitle'); if (!empty($svgTitle)) { $svgImgTag->set('title', $svgTitle); } echo $svgImgTag->toString(); $renderApi->renderChildren($unit); }
/** * @param $renderApi * @param \Render\Unit $unit * @param Array $tabTitles */ protected function renderTabBar($renderApi, $unit, $tabTitles) { $tabCount = 0; foreach ($tabTitles as $tabTitle) { $tabId = $unit->getId() . '_tab' . $tabCount; $input = new HtmlTagBuilder('input', array('type' => 'radio', 'name' => $unit->getId(), 'id' => $tabId)); if ($tabCount === 0) { $input->set('checked', null); } echo $input->toString(); $label = new HtmlTagBuilder('label', array('for' => $tabId, 'class' => 'tabLabel'), array($tabTitle)); echo $label->toString(); $tabCount++; } }
/** * @param \Render\APIs\APIv1\RenderAPI $renderApi * @param \Render\Unit $unit * @param \Render\APIs\APIv1\Navigation $navigation * @param array $navigatorIds * @param \Render\APIs\APIv1\Page $page * @param int $level * @param string $childrenMarkup * * @return string */ protected function getNavItemMarkup($renderApi, $unit, $navigation, array &$navigatorIds, $page, $level, $childrenMarkup) { $pageId = $page->getPageId(); $linkTag = new HtmlTagBuilder('a', array('class' => 'navLink'), array($page->getNavigationTitle())); $listTag = new HtmlTagBuilder('li', array('class' => 'navItem'), array($linkTag, $childrenMarkup)); // get url if ($renderApi->isEditMode()) { $linkTag->set('href', 'javascript:void(0);'); } else { $linkTag->set('href', $page->getUrl()); } // collect classes if ($this->isItemActive($pageId, $navigatorIds)) { $listTag->addClass('navItemActive'); $linkTag->addClass('navLinkActive'); } if ($pageId == $navigation->getCurrentPageId()) { $listTag->addClass('navItemCurrent'); $linkTag->addClass('navLinkCurrent'); } if ($this->hasChildPages($pageId, $navigation)) { $listTag->addClass('hasChildPages'); $linkTag->addClass('hasChildPages'); } return $listTag; // return $listTag->toString(); }