Beispiel #1
0
 /**
  * @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');
             }
         }
     }
 }
 protected function getHandleCode($api, $unit)
 {
     $textExpand = $api->getFormValue($unit, 'handleTextExpand');
     $textCollapse = $api->getFormValue($unit, 'handleTextCollapse');
     if (empty($textCollapse)) {
         $textCollapse = $textExpand;
     }
     $handle = new HtmlTagBuilder('div', array('class' => 'collapsibleHandle', 'data-duration' => str_replace('ms', '', $api->getFormValue($unit, 'animationDuration')), 'data-closeonlinkclick' => $api->getFormValue($unit, 'enableCloseOnLinkClick')), array(new HtmlTagBuilder('div', array('class' => 'collapse'), array(new HtmlTagBuilder('span', null, array($textCollapse)))), new HtmlTagBuilder('div', array('class' => 'expand'), array(new HtmlTagBuilder('span', null, array($textExpand))))));
     if ($api->getFormValue($unit, 'initialState') == 'collapsed') {
         $handle->addClass('collapsed');
     }
     return $handle->toString();
 }
Beispiel #3
0
 /**
  * @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);
     }
 }
Beispiel #4
0
 /**
  * @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();
 }
Beispiel #5
0
 /**
  * @param HtmlTagBuilder               $tag
  * @param \Render\APIs\APIv1\RenderAPI $api
  * @param \Render\Unit                 $unit
  * @param \Render\ModuleInfo           $moduleInfo
  */
 protected function modifyWrapperTag($tag, $api, $unit, $moduleInfo)
 {
     if (count($api->getChildren($unit)) === 0) {
         $tag->addClass('isAnchorAbsolute');
     }
 }