Retrieves Camp menu for any node.

@param \Drupal\node\NodeInterface $node
The node.

@return array
Array of menu links.
487170
public function getNodeCampMenu(NodeInterface $node) {
    if (!($camp = $this->getNodeCampNode($node))) {
      return [];
    }

    return $this->getCampNodeCampMenu($camp);
  }
124951
public function getFlattenChildren(Node $node)
    {
        $flatten = array();
        foreach ($node->getNodes() as $subNode) {
            if (count($subNode->getNodes()) > 1 || isset($subNode->getTrace()['query_source']) || !empty($subNode->getValues())) {
                $flatten[] = $subNode;
            } else {
                $flatten = array_merge($flatten, $this->getFlattenChildren($subNode));
            }
        }

        return $flatten;
    }
1077566
private function addNode(NodeInterface $node)
    {
        $this->nodeIndex++;
        $this->graph['nodes'][] = $node->toArray();

        return $this->nodeIndex;
    }
838142
private function getCampaignNodeCampaignMenu(NodeInterface $campaign) {
    /** @var \Drupal\node\Entity\Node $campaign */
    if ($campaign->bundle() != 'campaign') {
      return [];
    }

    // Get full menu from the Campaign node.
    $campaignMenu = $campaign->get('field_campaign_menu')->getValue();
    if (!empty($campaignMenu)) {
      $campaignMenu = unserialize($campaign->field_campaign_menu->value);
    }

    if (empty($campaignMenu)) {
      return [];
    }

    /** @var \Drupal\node\Entity\Node $landingPage */
    $landingPage = $this->getActiveCampaignPage($campaign);

    if (empty($landingPage)) {
      return [];
    }

    $links = [];
    foreach ($campaignMenu[$landingPage->id()]['links'] as $k => $link) {
      if (empty($link['page'])) {
        continue;
      }
      $linkPageId = $link['page'][0]['target_id'];

      // Replace the link on the main Campaign page by the Campaign's URL.
      if ($linkPageId == $landingPage->id()) {
        $linkPageId = $campaign->id();
      }
      $needsLogin = $link['logged'] && !MemberCampaign::isLoggedIn($campaign->id());
      $links['campaign_' . $k] = [
        '#type' => 'link',
        '#title' => $link['title'],
        '#url' => !$needsLogin
          ? Url::fromRoute('entity.node.canonical', ['node' => $linkPageId])
          : Url::fromRoute('openy_campaign.member-action', ['action' => 'login', 'campaign_id' => $campaign->id()])
        ,
        '#attributes' => [
          'class' => [
            'campaign-page',
            'node-' . $linkPageId,
            'active',
            !$needsLogin ? '' : 'use-ajax login',
          ],
        ],
      ];
    }

    return $links;
  }
433448
protected function getUriInformation(NodeInterface $node, ControllerContext $controllerContext): array
    {
        $nodeInfo = [];
        if (!$node->getNodeType()->isOfType($this->documentNodeTypeRole)) {
            return $nodeInfo;
        }

        try {
            $nodeInfo['uri'] = $this->createRedirectToNode($controllerContext, $node);
        } catch (\Neos\Flow\Mvc\Routing\Exception\MissingActionNameException $exception) {
            // Unless there is a serious problem with routes there shouldn't be an exception ever.
            $nodeInfo['uri'] = '';
        }

        return $nodeInfo;
    }
204783
public function findMostRelevantEnabledSiteFor(NodeInterface $node)
    {
        if (empty($node->ucms_enabled_sites)) {
            return; // Node cannot be viewed
        }

        if (in_array($node->site_id, $node->ucms_enabled_sites)) {
            // Per default, the primary site seems the best to work with
            return $node->site_id;
        }

        return reset($node->ucms_enabled_sites); // Fallback on first
    }
363512
public function node2Scope(SiteTreeNodeInterface $node){

        $scope = new TreeScope();
        $urlSegment = trim($node->getUrlSegment(),'/');

        $name = $urlSegment ? $urlSegment : TreeScope::DEFAULT_NAME;

        $scope->setPathPrefix($node->getUrlSegment());
        $scope->setName($name);
        $scope->setTitle($node->getMenuTitle());
        $scope->setModelRootId($node->{$this->treeModel->rootCol()});

        return $scope;

    }
646278
private function getLocationIDsByClassNode(NodeInterface $node) {
    if ($node->bundle() != 'class') {
      return [];
    }
    // Current node is a class.
    $class_id = $node->id();

    // Current date as timestamp.
    $current_date = strtotime("today UTC");

    /* @see \Drupal\openy_schedules\Form\SchedulesSearchForm::getSessions */
    $conditions['class'] = $class_id;
    $conditions['from'] = $current_date;

    $upcoming_session_instances = $this->getSessionInstancesByParams($conditions);

    $nids = [];
    foreach ($upcoming_session_instances as $session_instance) {
      $location_id = $session_instance->location->target_id;
      $nids[$location_id] = $location_id;
    }

    return $nids;
  }
1188417
public function cutNode(NodeInterface $node)
    {
        $this->nodeContextPath = $node->getContextPath();
        $this->mode = self::MODE_MOVE;
    }
376517
protected function getBasicNodeInformation(NodeInterface $node): array
    {
        return [
            'contextPath' => $node->getContextPath(),
            'name' => $node->getName(),
            'identifier' => $node->getIdentifier(),
            'nodeType' => $node->getNodeType()->getName(),
            'label' => $node->getLabel(),
            'isAutoCreated' => $node->isAutoCreated(),
            'depth' => $node->getDepth(),
            'children' => [],
            'matchesCurrentDimensions' => ($node instanceof Node && $node->dimensionsAreMatchingTargetDimensionValues())
        ];
    }
512427
protected function parseNode(NodeInterface $node)
    {
        return (object)[
            'type'       => $this->parseNodeType($node),
            'id'         => $node->getId() ?: null,
            'properties' => $this->parseNodeProperties($node),
        ];
    }
732847
public function getNodeCampaignNode(NodeInterface $node) {
    $campaign = NULL;

    if ($node->getType() == 'campaign') {
      return $node;
    }

    if ($node->getType() == 'campaign_page') {
      $campaign = $node->field_campaign_parent->entity;
      if (!empty($campaign)) {
        return $campaign;
      }
    }

    /** @var \Drupal\node\NodeStorage $nodeStorage */
    $nodeStorage = $this->entityTypeManager->getStorage('node');

    // Get Campaign node with reference to given Landing page node.
    /** @var \Drupal\Core\Entity\Query\QueryInterface $query */
    $query = $nodeStorage->getQuery()
      ->condition('status', 1)
      ->condition('type', 'campaign');
    $orGroup = $query->orConditionGroup()
      ->condition('field_campaign_pages', $node->id(), 'IN')
      ->condition('field_pause_landing_page', $node->id());
    $nids = $query->condition($orGroup)->execute();

    /** @var \Drupal\node\NodeInterface $campaign */
    $campaign = $nodeStorage->load(reset($nids));

    return $campaign;
  }
957228
public function getInternalLinks( \DOMNode $node ) : array
	{
		$this->guardHasOwnerDocument( $node );

		$internalLinks = [];
		$xpath         = new \DOMXPath( $node->ownerDocument );
		$aTags         = $xpath->query( '*//a[@href]' );

		/** @var \DOMElement $aTag */
		foreach ( $aTags as $aTag )
		{
			$href = $aTag->getAttribute( 'href' );
			if ( !$this->isHyperRefIgnored( $href ) )
			{
				$internalLinks[] = $aTag;
			}
		}

		return $internalLinks;
	}
975992
public function showWinners(NodeInterface $node) {
    $winnersList = views_embed_view('campaign_winners', 'campaign_winners_page', $node->id());
    $winnersCalculateForm = $this->formBuilder()->getForm(WinnersCalculateForm::class, $node->id());

    $build = [
      'view' => $winnersList,
      'form' => $winnersCalculateForm,
    ];

    return $build;
  }
341776
public function nodeUpdated(NodeInterface $node)
    {
        if (!$this->eventEmittingService->isEnabled()) {
            return;
        }

        if (!isset($this->changedNodes[$node->getContextPath()])) {
            $this->changedNodes[$node->getContextPath()] = ['node' => $node];
        }
    }
173506
public function removeNode(NodeInterface $node): NodeInterface
    {
        unset($this->_nodes[$node->getId()]);

        if ($this->getParent()) {
            $this->getParent()->removeNode($node);
        }

        return $this;
    }
1074890
public function getNode( $node )
	{
		for( $i=0; $i<$this->count(); $i++ )
			if( $this->nodes[$i]->getNodeName() == $node )
				return $this->nodes[$i];
		return NULL;
	}