You are here

function EditionsController::getPid in Simplenews Scheduler 2.0.x

Same name and namespace in other branches
  1. 8 src/Controller/EditionsController.php \Drupal\simplenews_scheduler\Controller\EditionsController::getPid()

Helper function to get the identifier of newsletter.

Parameters

$node: The node object for the newsletter.

Return value

If the node is a newsletter edition, the node id of its parent template newsletter; if the node is a template newsletter, its own node id; and FALSE if the node is not part of a scheduled newsletter set.

1 call to EditionsController::getPid()
EditionsController::nodeEditionsPage in src/Controller/EditionsController.php

File

src/Controller/EditionsController.php, line 92
Contains \Drupal\simplenews_scheduler\Controller\EditionsController.

Class

EditionsController
Default controller for the simplenews_scheduler module.

Namespace

Drupal\simplenews_scheduler\Controller

Code

function getPid(NodeInterface $node) {

  // First assume this is a newsletter edition,
  if (isset($node->simplenews_scheduler_edition)) {
    return $node->simplenews_scheduler_edition->pid;
  }
  elseif (isset($node->simplenews_scheduler)) {
    return $node
      ->id();
  }
  return FALSE;
}