obj = $obj; $this->link = $link; $this->isCurrent = $isCurrent; $this->numChildrenMethod = $numChildrenMethod; $this->filter = $filter; } /** * Returns template, for further processing by {@link Hierarchy->getChildrenAsUL()}. * Does not include closing tag to allow this method to inject its own children. * * @todo Remove hardcoded assumptions around returning an
  • , by implementing recursive tree node rendering * * @return String */ public function forTemplate() { $obj = $this->obj; return "
  • ID\" data-id=\"$obj->ID\" data-pagetype=\"$obj->ClassName\" class=\"" . $this->getClasses() . "\">" . " " . "getLink() . "\" title=\"(" . trim(_t('LeftAndMain.PAGETYPE', 'Page type'), " :") // account for inconsistencies in translations . ": " . $obj->i18n_singular_name() . ") $obj->Title\" > " . ($obj->TreeTitle) . ""; } /** * Determine the CSS classes to apply to this node * * @return string */ public function getClasses() { // Get classes from object $classes = $this->obj->CMSTreeClasses($this->numChildrenMethod); if ($this->isCurrent) { $classes .= ' current'; } // Get status flag classes $flags = $this->obj->hasMethod('getStatusFlags') ? $this->obj->getStatusFlags() : false; if ($flags) { $statuses = array_keys($flags); foreach ($statuses as $s) { $classes .= ' status-' . $s; } } // Get additional filter classes if ($this->filter && ($filterClasses = $this->filter->getPageClasses($this->obj))) { if (is_array($filterClasses)) { $filterClasses = implode(' ' . $filterClasses); } $classes .= ' ' . $filterClasses; } return $classes; } public function getObj() { return $this->obj; } public function setObj($obj) { $this->obj = $obj; return $this; } public function getLink() { return $this->link; } public function setLink($link) { $this->link = $link; return $this; } public function getIsCurrent() { return $this->isCurrent; } public function setIsCurrent($bool) { $this->isCurrent = $bool; return $this; } }