Index all children of the specified node (only for the specified
language)

@param Node   $node
@param string $lang
185214
public function indexChildren(Node $node, $lang)
    {
        foreach ($node->getChildren() as $childNode) {
            $this->indexNode($childNode, $lang);
        }
    }
828947
public function indexCustom( &$types, &$node, &$element )
	{
		foreach ( $this->documentPrefixes as $prefix => $namespace )
		{
			// Ignore standard namespaces
			// BMS 2018-04-09 Fixing the kluge
			// if ( $prefix == "xs" ) $prefix = "xsd";
			if ( empty( $prefix ) || isset( \XBRL_Constants::$standardPrefixes[ $prefix ] ) )
			{
				continue;
			}

			// Look for attributes with a non-standard prefix
			foreach ( $node->attributes( $namespace ) as $key => $attribute )
			{
				$element['custom'][ "$prefix:$key" ] = (string)$attribute;
			}
		}
	}
306983
public function createNewLanguageNode(NodeInterface $node, $language)
    {
        $newNode = clone $node;
        $newNode->setVersion($this->uniqueIdGenerator->generateUniqueId());
        $status = $this->statusRepository->findOneByTranslationState();

        $newNode->setStatus($status);
        $newNode = $this->duplicateArea($node, $newNode, false);

        $newNode->setLanguage($language);
        $newNode->setSeoTitle(null);
        $newNode->setMetaDescription(null);
        $newNode->setMetaIndex(false);
        $newNode->setMetaFollow(false);
        $newNode->setSitemapChangefreq(null);
        $newNode->setSitemapPriority(null);
        $newNode->initializeKeywords();

        $this->eventDispatcher->dispatch(NodeEvents::NODE_ADD_LANGUAGE, new NodeEvent($node));

        return $newNode;
    }
1301655
private function _retrieveNodeText(DOMNode $node, &$text)
    {
        if ($node->nodeType == XML_TEXT_NODE) {
            $text .= $node->nodeValue;
            if(!in_array($node->parentNode->tagName, $this->_inlineTags)) {
                $text .= ' ';
            }
        } else if ($node->nodeType == XML_ELEMENT_NODE  &&  $node->nodeName != 'script') {
            foreach ($node->childNodes as $childNode) {
                $this->_retrieveNodeText($childNode, $text);
            }
        }
    }
1029726
public function enterNode(Node $node)
    {
        if ($node instanceof Stmt\Namespace_) {
            $this->cancelNext = true;
            $this->namespaceNode = $node->name;
        } elseif ($node instanceof Stmt\GroupUse) {
            $this->cancelNext = true;
            $this->groupImport = $node->prefix;
            foreach ($node->uses as $use) {
                $this->importNodes[] = Name::concat($node->prefix, $use->name);
            }
        } elseif ($node instanceof Stmt\Use_) {
            foreach ($node->uses as $use) {
                $this->importNodes[] = $use->name;
            }
        } elseif ($node instanceof Stmt\UseUse) {
            $this->isImport = true;
        } elseif ($node instanceof Expr\FuncCall) {
            $this->cancelNext = true;
        } elseif ($node instanceof Expr\ConstFetch) {
            $this->cancelNext = true;
        } elseif ($node instanceof Expr\StaticCall) {
            $this->cancelNext = true;
        } elseif ($node instanceof Expr\StaticPropertyFetch) {
            $lc = strtolower($node->class->toString());
            if (in_array($lc, ['static', 'self', 'parent'])) {
                $this->cancelNext = true;
            }
        } elseif ($node instanceof Expr\ClassConstFetch) {
            $lc = strtolower($node->class->toString());
            if (in_array($lc, ['static', 'self', 'parent'])) {
                $this->cancelNext = true;
            }
        } elseif ($node instanceof Expr\New_) {
            if ($node->class && $node->class instanceof Name) {
                $lc = strtolower($node->class->toString());
                if (in_array($lc, ['static', 'self', 'parent'])) {
                    $this->cancelNext = true;
                }
            }
        }
    }
504993
private function updateNodeChildren(NodeTranslation $node, EntityManagerInterface $em, ClassMetadata $class)
    {
        $children = $node->getNode()->getChildren();
        if (\count($children) > 0) {
            /* @var Node $child */
            foreach ($children as $child) {
                $translation = $child->getNodeTranslation($node->getLang(), true);
                if ($translation) {
                    $translation = $this->updateUrl($translation, $em);

                    if ($translation !== false) {
                        $em->persist($translation);
                        $em->getUnitOfWork()->recomputeSingleEntityChangeSet($class, $translation);

                        $this->updateNodeChildren($translation, $em, $class);
                    }
                }
            }
        }
    }
1322447
public function addNode(TreeNodeInterface $node, $language, $viaQueue = false)
    {
        $this->logger->debug("addNode {$node->getId()} {$language}");

        $descriptor = $this->identifier->createDescriptorFromNode($node, $language);

        if ($viaQueue) {
            $this->queueDescriptorOperation('add', $descriptor);
        } else {
            $this->executeDescriptorOperation('add', $descriptor);
        }

        return 1;
    }
772934
public function _e(string $key, ?string $lang = null): void
    {
        echo $this->__($key, $lang);
    }
1363712
public function setLang($lang, $name, $sectionName = null, $elementName = null)
    {
        $setting = ['NAME' => $name];

        if ($sectionName) {
            $setting['SECTION_NAME'] = $sectionName;
        }
        if ($elementName) {
            $setting['ELEMENT_NAME'] = $elementName;
        }

        $this->fields['LANG'][$lang] = $setting;

        return $this;
    }
729026
public function serializeNode(TreeNodeInterface $node, $language, TokenInterface $token)
    {
        $userRights = $this->nodePermissionResolver->resolve($node, $language, $token);
        if ($userRights === null) {
            return null;
        }

        $eid = $node->getTypeId();
        $element = $this->elementService->findElement($eid);
        $elementVersion = $this->elementService->findLatestElementVersion($element);

        //$identifier = new Makeweb_Elements_Element_Identifier($eid);
        $lockQtip = '';
        /*
        #if ($lockInfo = $lockManager->getLockInformation($identifier))
        #{
        #    if ($lockInfo['lock_uid'] == MWF_Env::getUid())
        #    {
        #        $lockQtip = '<hr>Locked by me.';
        #    }
        #    else
        #    {
        #        try
        #        {
        #            $user = MWF_Core_Users_User_Peer::getByUserID($lockInfo['lock_uid']);
        #        }
        #        catch (Exception $e)
        #        {
        #            $user = MWF_Core_Users_User_Peer::getSystemUser();
        #        }
        #
        #        $lockQtip = '<hr>Locked by '.$user->getUsername().'.';
        #    }
        #}
        */

        $elementtype = $this->elementService->findElementtype($element);
        $allowedElementtypeIds = [];
        foreach ($this->elementService->findAllowedChildren($elementtype) as $allowedElementtype) {
            $allowedElementtypeIds[] = $allowedElementtype->getId();
        }

        $qtip = 'TID: '.$node->getId().'<br />'.
            'EID: '.$element->getEid().'<br />'.
            'Version: '.$elementVersion->getVersion().'<br />'.
            '<hr>'.
            'Element Type: '.$elementtype->getTitle().'<br />'.
            'Element Type Version: '.$elementtype->getRevision().
            $lockQtip;

        $data = [
            'id' => $node->getID(),
            'eid' => $element->getEid(),
            'text' => $elementVersion->getBackendTitle($language, $element->getMasterLanguage()),
            'icon' => $this->iconResolver->resolveTreeNode($node, $language),
            'navigation' => $node->getInNavigation(),
            'restricted' => $node->getNeedAuthentication(),
            'element_type' => $elementtype->getTitle(),
            'element_type_id' => $elementtype->getId(),
            'element_type_type' => $elementtype->getType(),
            'alias' => $node->getTree()->isInstance($node),
            'allow_drag' => true,
            'sort_mode' => $node->getSortMode(),
            'areas' => [355],
            'allowed_et' => $allowedElementtypeIds,
            'is_published' => $this->stateManager->isPublished($node, $language),
            'rights' => $userRights,
            'qtip' => $qtip,
            'allow_children' => $elementtype->getHideChildren() ? false : true,
            'default_tab' => $elementtype->getDefaultTab(),
            'default_content_tab' => $elementtype->getDefaultContentTab(),
            'masterlanguage' => $element->getMasterLanguage(),
        ];

        if (count($node->getTree()->getChildren($node)) && !$elementtype->getHideChildren()) {
            $data['leaf'] = false;
            $data['expanded'] = false;
        } else {
            $data['leaf'] = true;
            $data['expanded'] = false;
        }

        if ($node->isRoot()) {
            $data['cls'] = 'siteroot-node';
            $data['expanded'] = true;
        }

        return $data;
    }
823910
public function enterNode(Node $node)
    {
        if ($node instanceof Stmt\Namespace_) {
            $this->namespaceNode = $node->name;
        } elseif ($node instanceof Stmt\GroupUse) {
            foreach ($node->uses as $use) {
                $this->importNodes[] = Name::concat($node->prefix, $use->name);
            }
        } elseif ($node instanceof Stmt\Use_) {
            foreach ($node->uses as $use) {
                $this->importNodes[] = $use->name;
            }
        } elseif ($node instanceof Stmt\Class_) {
            $this->classNode = $node;
        }
    }
232888
private function getTags(NodeInterface $node, $locale)
    {
        return $node->getPropertyValueWithDefault(
            sprintf(self::TAGS_PROPERTY, $locale),
            []
        );
    }
1039568
private function parseLevel($node) {
    if ($this->tryMatch('(', $node, 'openParen')) {
      $this->mustMatch(T_LNUMBER, $node, 'level');
      $this->mustMatch(')', $node, 'closeParen');
    }
    else {
      $this->mustMatch(T_LNUMBER, $node, 'level');
    }
  }
207649
public function getMaxChildrenWeight(Node $parentNode = null, $lang = null)
    {
        $maxWeight = $this->getNodeTranslationsQueryBuilder($lang)
            ->select('max(nt.weight)')
            ->andWhere('n.parent = :parentNode')
            ->setParameter('parentNode', $parentNode)
            ->getQuery()
            ->getSingleScalarResult();

        return (int) $maxWeight;
    }
1214444
public function parseXml($node)
    {
        foreach ($node->childNodes as $item) {
            switch ($item->nodeName) {
                case "day_entry":
                    $this->_dayEntry = new DayEntry();
                    $this->_dayEntry->parseXml( $node );
                break;
                case "hours_for_previously_running_timer":
                    $this->_hoursForPrevious = $item->nodeValue;
                break;
                default:
                break;
            }
        }
    }
1237203
private function deleteChildren( $node ) {
		while ( isset( $node->firstChild ) ) {
			$this->deleteChildren( $node->firstChild );
			$node->removeChild( $node->firstChild );
		}
	}
1256290
public function visit($query, $node, string $context)
    {
        if ($node instanceof $this->node) {
            $bindings = [];
            $sql = [];

            $child0 = $node->getChildByIndex(0);
            $child1 = $node->getChildByIndex(1);

            if ($child0 instanceof Nodes\KeyNode) {
                $context === Nodes\OrNode::class && $query->orWhereNotNull($this->parseKey($child0->getValue()));
                $context === Nodes\AndNode::class && $query->whereNotNull($this->parseKey($child0->getValue()));
            }
        }
    }