class RevisionLink
Same name and namespace in other branches
- 11.x core/modules/node/src/Plugin/views/field/RevisionLink.php \Drupal\node\Plugin\views\field\RevisionLink
Field handler to present a link to a node revision.
Plugin annotation
@ViewsField("node_revision_link");
Hierarchy
- class \Drupal\Component\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\views\Plugin\views\HandlerBase extends \Drupal\views\Plugin\views\ViewsHandlerInterface implements \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\field\FieldPluginBase extends \Drupal\views\Plugin\views\field\FieldHandlerInterface implements \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\field\LinkBase uses \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\views\Entity\Render\EntityTranslationRenderTrait implements \Drupal\views\Plugin\views\field\FieldPluginBase
- class \Drupal\node\Plugin\views\field\RevisionLink implements \Drupal\views\Plugin\views\field\LinkBase
- class \Drupal\views\Plugin\views\field\LinkBase uses \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\views\Entity\Render\EntityTranslationRenderTrait implements \Drupal\views\Plugin\views\field\FieldPluginBase
- class \Drupal\views\Plugin\views\field\FieldPluginBase extends \Drupal\views\Plugin\views\field\FieldHandlerInterface implements \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\HandlerBase extends \Drupal\views\Plugin\views\ViewsHandlerInterface implements \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of RevisionLink
Related topics
File
-
core/
modules/ node/ src/ Plugin/ views/ field/ RevisionLink.php, line 16
Namespace
Drupal\node\Plugin\views\fieldView source
class RevisionLink extends LinkBase {
/**
* {@inheritdoc}
*/
protected function getUrlInfo(ResultRow $row) {
/** @var \Drupal\node\NodeInterface $node */
$node = $this->getEntity($row);
// Current revision uses the node view path.
return !$node->isDefaultRevision() ? Url::fromRoute('entity.node.revision', [
'node' => $node->id(),
'node_revision' => $node->getRevisionId(),
]) : $node->toUrl();
}
/**
* {@inheritdoc}
*/
protected function renderLink(ResultRow $row) {
/** @var \Drupal\node\NodeInterface $node */
$node = $this->getEntity($row);
if (!$node->getRevisionid()) {
return '';
}
$text = parent::renderLink($row);
$this->options['alter']['query'] = $this->getDestinationArray();
return $text;
}
/**
* {@inheritdoc}
*/
protected function getDefaultLabel() {
return $this->t('View');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.