/**
  * Renders a node recursive or just a single instance
  *
  * @param \TYPO3\CMS\Backend\Tree\TreeRepresentationNode $node
  * @param bool $recursive
  * @return string
  */
 public function renderNode(\TYPO3\CMS\Backend\Tree\TreeRepresentationNode $node, $recursive = true)
 {
     $code = '<li><span class="' . htmlspecialchars($node->getIcon()) . '">&nbsp;</span>' . htmlspecialchars($node->getLabel());
     if ($recursive && $node->getChildNodes() !== null) {
         $this->recursionLevel++;
         $code .= $this->renderNodeCollection($node->getChildNodes());
         $this->recursionLevel--;
     }
     $code .= '</li>';
     return $code;
 }
 /**
  * Get node array
  *
  * @param \TYPO3\CMS\Backend\Tree\TreeRepresentationNode $node
  * @return array
  */
 protected function getNodeArray(\TYPO3\CMS\Backend\Tree\TreeRepresentationNode $node)
 {
     $nodeArray = array('iconCls' => $node->getIcon(), 'text' => $node->getLabel(), 'leaf' => !$node->hasChildNodes(), 'id' => $node->getId(), 'uid' => $node->getId());
     foreach ($nodeArray as &$nodeItem) {
         if (is_string($nodeItem)) {
             $nodeItem = htmlspecialchars($nodeItem);
         }
     }
     return $nodeArray;
 }
 /**
  * Get node array
  *
  * @param \TYPO3\CMS\Backend\Tree\TreeRepresentationNode $node
  * @return array
  */
 protected function getNodeArray(\TYPO3\CMS\Backend\Tree\TreeRepresentationNode $node)
 {
     $nodeArray = array('iconCls' => $node->getIcon(), 'text' => $node->getLabel(), 'leaf' => !$node->hasChildNodes(), 'id' => $node->getId(), 'uid' => $node->getId());
     return $nodeArray;
 }
Example #4
0
 /**
  * Get node array
  *
  * @param \TYPO3\CMS\Backend\Tree\TreeRepresentationNode|DatabaseTreeNode $node
  * @return array
  */
 protected function getNodeArray(\TYPO3\CMS\Backend\Tree\TreeRepresentationNode $node)
 {
     $overlayIconMarkup = '';
     if (is_object($node->getIcon())) {
         $iconMarkup = $node->getIcon()->getMarkup(SvgIconProvider::MARKUP_IDENTIFIER_INLINE);
         if (is_object($node->getIcon()->getOverlayIcon())) {
             $overlayIconMarkup = $node->getIcon()->getOverlayIcon()->getMarkup(SvgIconProvider::MARKUP_IDENTIFIER_INLINE);
         }
     } else {
         $iconMarkup = $node->getIcon();
     }
     $nodeArray = ['identifier' => htmlspecialchars($node->getId()), 'name' => $node->getLabel(), 'icon' => $iconMarkup, 'overlayIcon' => $overlayIconMarkup, 'depth' => $this->recursionLevel, 'hasChildren' => (bool) $node->hasChildNodes(), 'selectable' => true];
     if ($node instanceof DatabaseTreeNode) {
         $nodeArray['checked'] = (bool) $node->getSelected();
         if (!$node->getSelectable()) {
             $nodeArray['checked'] = false;
             $nodeArray['selectable'] = false;
         }
     }
     return $nodeArray;
 }