You are here

public function PreviewLink::setToken in Preview Link 8

Same name and namespace in other branches
  1. 2.x src/Entity/PreviewLink.php \Drupal\preview_link\Entity\PreviewLink::setToken()
  2. 2.0.x src/Entity/PreviewLink.php \Drupal\preview_link\Entity\PreviewLink::setToken()

Set the new token.

Parameters

string $token: The new token.

Return value

\Drupal\preview_link\Entity\PreviewLinkInterface Returns the preview link for chaining.

Overrides PreviewLinkInterface::setToken

File

src/Entity/PreviewLink.php, line 61

Class

PreviewLink
Defines the node entity class.

Namespace

Drupal\preview_link\Entity

Code

public function setToken($token) {
  $this
    ->set('token', $token);

  // Add a second so our testing always works.
  $this
    ->set('generated_timestamp', time() + 1);
  return $this;
}