diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php index 772e2e6..79147fe 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php @@ -101,6 +101,12 @@ public function settingsForm(array $form, FormStateInterface $form_state) { '#default_value' => $this->getSetting('link_to_entity'), ); + // if the entity is a revision, just change the UI, we're using the same option and link + // to the revision in this case. + if ($entity_type->isRevisionable() && $entity_type->hasLinkTemplate('revision')) { + $form['link_to_entity']['#title'] = $this->t('Link to the revision'); + } + return $form; } @@ -113,6 +119,10 @@ public function settingsSummary() { $entity_type = $this->entityManager->getDefinition($this->fieldDefinition->getTargetEntityTypeId()); $summary = array($this->t('Linked to the @entity_label', ['@entity_label' => $entity_type->getLabel()])); } + + if ($this instanceof RevisionableInterface) { + $summary = array($this->t('Link to the revision')); + } return $summary; } diff --git a/core/modules/node/src/Plugin/views/wizard/NodeRevision.php b/core/modules/node/src/Plugin/views/wizard/NodeRevision.php index fafb3fc..d2b9b0b 100644 --- a/core/modules/node/src/Plugin/views/wizard/NodeRevision.php +++ b/core/modules/node/src/Plugin/views/wizard/NodeRevision.php @@ -103,8 +103,10 @@ protected function defaultDisplayOptions() { $display_options['fields']['title']['alter']['html'] = 0; $display_options['fields']['title']['hide_empty'] = 0; $display_options['fields']['title']['empty_zero'] = 0; - $display_options['fields']['title']['settings']['link_to_entity'] = 0; + $display_options['fields']['title']['link_to_node'] = 0; + $display_options['fields']['title']['link_to_node_revision'] = 1; $display_options['fields']['title']['plugin_id'] = 'field'; + return $display_options; }