.../lib/Drupal/node/Controller/NodeController.php | 13 ------------- .../Drupal/node/Controller/NodeViewController.php | 22 +++++++++++++++------- core/modules/node/node.routing.yml | 2 +- .../quickedit/Tests/QuickEditLoadingTest.php | 3 ++- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/core/modules/node/lib/Drupal/node/Controller/NodeController.php b/core/modules/node/lib/Drupal/node/Controller/NodeController.php index d1b1a56..ccc3037 100644 --- a/core/modules/node/lib/Drupal/node/Controller/NodeController.php +++ b/core/modules/node/lib/Drupal/node/Controller/NodeController.php @@ -118,19 +118,6 @@ public function revisionOverview(NodeInterface $node) { } /** - * The _title_callback for the node.view route. - * - * @param NodeInterface $node - * The current node. - * - * @return string - * The page title. - */ - public function pageTitle(NodeInterface $node) { - return String::checkPlain($this->entityManager()->getTranslationFromContext($node)->label()); - } - - /** * The _title_callback for the node.add route. * * @param \Drupal\node\NodeTypeInterface $node_type diff --git a/core/modules/node/lib/Drupal/node/Controller/NodeViewController.php b/core/modules/node/lib/Drupal/node/Controller/NodeViewController.php index 706e4ee..afdb085 100644 --- a/core/modules/node/lib/Drupal/node/Controller/NodeViewController.php +++ b/core/modules/node/lib/Drupal/node/Controller/NodeViewController.php @@ -7,6 +7,7 @@ namespace Drupal\node\Controller; +use Drupal\Component\Utility\String; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\Controller\EntityViewController; @@ -16,13 +17,7 @@ class NodeViewController extends EntityViewController { /** - * Displays a node. - * - * @param \Drupal\node\EntityInterface $node - * The node we are displaying. - * - * @return array - * An array suitable for drupal_render(). + * {@inheritdoc} */ public function view(EntityInterface $node, $view_mode = 'full', $langcode = NULL) { $build = array('nodes' => parent::view($node)); @@ -53,4 +48,17 @@ public function view(EntityInterface $node, $view_mode = 'full', $langcode = NUL return $build; } + /** + * The _title_callback for the page that renders a single node. + * + * @param \Drupal\Core\Entity\EntityInterface $node + * The current node. + * + * @return string + * The page title. + */ + public function title(EntityInterface $node) { + return String::checkPlain($this->entityManager->getTranslationFromContext($node)->label()); + } + } diff --git a/core/modules/node/node.routing.yml b/core/modules/node/node.routing.yml index 4059da9..03ce347 100644 --- a/core/modules/node/node.routing.yml +++ b/core/modules/node/node.routing.yml @@ -48,7 +48,7 @@ node.view: path: '/node/{node}' defaults: _content: '\Drupal\node\Controller\NodeViewController::view' - _title_callback: '\Drupal\node\Controller\NodeController::pageTitle' + _title_callback: '\Drupal\node\Controller\NodeViewController::title' requirements: _entity_access: 'node.view' diff --git a/core/modules/quickedit/lib/Drupal/quickedit/Tests/QuickEditLoadingTest.php b/core/modules/quickedit/lib/Drupal/quickedit/Tests/QuickEditLoadingTest.php index dce9574..b912bbe 100644 --- a/core/modules/quickedit/lib/Drupal/quickedit/Tests/QuickEditLoadingTest.php +++ b/core/modules/quickedit/lib/Drupal/quickedit/Tests/QuickEditLoadingTest.php @@ -301,7 +301,8 @@ public function testTitleBaseField() { // Ensure that the full page title is actually in-place editable $node = entity_load('node', 1); - $this->assertRaw('

' . $node->label() . '

'); + $elements = $this->xpath('//h1/span[@data-quickedit-field-id="node/1/title/und/full" and normalize-space(text())=:title]', array(':title' => $node->label())); + $this->assertTrue(!empty($elements), 'Title with data-quickedit-field-id attribute found.'); // Retrieving the metadata should result in a 200 JSON response. $htmlPageDrupalSettings = $this->drupalSettings;