getRevisionid example


    // Original author, and editor names should appear on revisions overview.     $web_user = $nodes[0]->revision_uid->entity;
    $this->assertSession()->pageTextContains('by ' . $web_user->getAccountName());
    $editor = $nodes[2]->revision_uid->entity;
    $this->assertSession()->pageTextContains('by ' . $editor->getAccountName());

    // Confirm that this is the default revision.     $this->assertTrue($node->isDefaultRevision(), 'Third node revision is the default one.');

    // Confirm that revisions revert properly.     $this->drupalGet("node/" . $node->id() . "/revisions/" . $nodes[1]->getRevisionid() . "/revert");
    $this->submitForm([], 'Revert');
    $this->assertSession()->pageTextContains("Basic page {$nodes[1]->label()} has been reverted to the revision from {$this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime())}.");
    $node_storage->resetCache([$node->id()]);
    $reverted_node = $node_storage->load($node->id());
    $this->assertSame($nodes[1]->body->value, $reverted_node->body->value, 'Node reverted correctly.');
    // Confirm the revision author is the user performing the revert.     $this->assertSame($this->loggedInUser->id()$reverted_node->getRevisionUserId(), 'Node revision author is user performing revert.');
    // And that its not the revision author.     $this->assertNotSame($nodes[1]->getRevisionUserId()$reverted_node->getRevisionUserId(), 'Node revision author is not original revision author.');

    // Confirm that this is not the default version.
'node_revision' => $node->getRevisionId(),
      ]) :
      $node->toUrl();
  }

  /** * {@inheritdoc} */
  protected function renderLink(ResultRow $row) {
    /** @var \Drupal\node\NodeInterface $node */
    $node = $this->getEntity($row);
    if (!$node || !$node->getRevisionid()) {
      return '';
    }
    $text = parent::renderLink($row);
    $this->options['alter']['query'] = $this->getDestinationArray();
    return $text;
  }

  /** * {@inheritdoc} */
  protected function getDefaultLabel() {
    
Home | Imprint | This part of the site doesn't use cookies.