/** * Gets the node tree in a text format * @param string $locale Locale of the structure * @param \ride\library\cms\node\Node $parent Parent node of the structure * @return string Node tree in text format */ public function getStructure($locale, Node $parent) { if ($parent->getRootNode()->isLocalizationMethodUnique()) { $isUniqueTree = true; } else { $isUniqueTree = false; } $structure = ''; $children = $parent->getChildren(); foreach ($children as $child) { if ($isUniqueTree && !$child->isAvailableInLocale($locale)) { continue; } $structure .= $child->getName($locale); $structure .= ' [' . $child->getRoute($locale) . '|' . $child->getType() . '|' . $child->getId() . ']'; $structure .= "\n"; $childStructure = $this->getStructure($locale, $child); if ($childStructure) { $structure .= rtrim(' ' . str_replace("\n", "\n ", $childStructure)) . "\n"; } } return $structure; }