public function getCampaignNodeFromRoute() {
    $node = $this->routeMatch->getParameter('node');
    // For custom routes - get campaign_id.
    if ($node instanceof NodeInterface !== TRUE) {
      $campaignId = $this->routeMatch->getParameter('campaign_id');
      if (is_null($campaignId)) {
        $campaignId = $this->container->get('request_stack')->getCurrentRequest()->get('campaign_id');
      }
      $node = !empty($campaignId) ? $this->entityTypeManager->getStorage('node')->load($campaignId) : FALSE;
    }
    if (empty($node)) {
      return FALSE;
    }
    /** @var \Drupal\node\NodeInterface $campaign */
    $campaign = $this->getNodeCampaignNode($node);

    return !empty($campaign) && ($campaign->getType() == 'campaign') ? $campaign : FALSE;
  }
public function getCampaignNodeFromRoute() {
    $node = $this->routeMatch->getParameter('node');
    // For custom routes - get campaign_id.
    if ($node instanceof NodeInterface !== TRUE) {
      $campaignId = $this->routeMatch->getParameter('campaign_id');
      if (is_null($campaignId)) {
        $campaignId = $this->container->get('request_stack')->getCurrentRequest()->get('campaign_id');
      }
      $node = !empty($campaignId) ? $this->entityTypeManager->getStorage('node')->load($campaignId) : FALSE;
    }
    if (empty($node)) {
      return FALSE;
    }
    /** @var \Drupal\node\NodeInterface $campaign */
    $campaign = $this->getNodeCampaignNode($node);

    return !empty($campaign) && ($campaign->getType() == 'campaign') ? $campaign : FALSE;
  }
public function getCampaignNodeFromRoute ( ) { $ node = $ this -> routeMatch -> getParameter ( 'node' ) ; // For custom routes - get campaign_id. if ( $ node instanceof NodeInterface !== TRUE ) { $ campaignId = $ this -> routeMatch -> getParameter ( 'campaign_id' ) ; if ( is_null ( $ campaignId ) ) { $ campaignId = $ this -> container -> get ( 'request_stack' ) -> getCurrentRequest ( ) -> get ( 'campaign_id' ) ; } $ node = ! empty ( $ campaignId ) ? $ this -> entityTypeManager -> getStorage ( 'node' ) -> load ( $ campaignId ) : FALSE ; } if ( empty ( $ node ) ) { return FALSE ; } /** @var \Drupal\node\NodeInterface $campaign */ $ campaign = $ this -> getNodeCampaignNode ( $ node ) ; return ! empty ( $ campaign ) && ( $ campaign -> getType ( ) == 'campaign' ) ? $ campaign : FALSE ; }
Get campaign node from current page URL.

@return bool|\Drupal\node\NodeInterface
Get campaign node from current page URL .