Subtask of #1830588: [META] remove drupal_set_title() and drupal_get_title()

Problem/Motivation

Using procedural drupal_set_title() inside controller class is not encouraged.

Proposed resolution

Replace drupal_set_title() with #title in page return array.

Remaining tasks

Issue patch

User interface changes

Refer parent issue at #1830588: [META] remove drupal_set_title() and drupal_get_title()

API changes

Refer parent issue at #1830588: [META] remove drupal_set_title() and drupal_get_title()

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JulienD’s picture

Status: Active » Needs review
FileSize
3.46 KB

Here is a try to remove the drupal_set_title in the help module.

According to https://drupal.org/node/2102369#comment-7930793 I have left the title callback in the hook_menu.

vijaycs85’s picture

+++ b/core/modules/help/lib/Drupal/help/Controller/HelpController.php
@@ -118,7 +118,7 @@ public function helpPage($name) {
       if (!empty($admin_tasks)) {
         $links = array();

@@ -142,4 +142,18 @@ public function helpPage($name) {
+    return $this->t($info['name']);

Not sure we really need to t() the dynamic name?

Status: Needs review » Needs work

The last submitted patch, drupal8.help-module.2102453-1.patch, failed testing.

InternetDevels’s picture

Status: Needs work » Needs review
FileSize
851 bytes

More simpler solution.

Status: Needs review » Needs work
Issue tags: -WSCCI Conversions

The last submitted patch, drupal-remove_drupal_set_title_in_help_module-2102453-4.patch, failed testing.

disasm’s picture

Status: Needs work » Needs review
Issue tags: +WSCCI Conversions
dawehner’s picture

Status: Needs review » Needs work
+++ b/core/modules/help/lib/Drupal/help/Controller/HelpController.php
@@ -106,8 +106,8 @@ public function helpPage($name) {
+      $build['#title'] = $info[$name]['name'];

We should check plain the output, just to be sure and mirror the previous behavior.

ACF’s picture

Status: Needs work » Needs review
Issue tags: +London_2013_October
FileSize
739 bytes

Added check_plain to the previous patch.

dawehner’s picture

Status: Needs review » Needs work
+++ b/core/modules/help/lib/Drupal/help/Controller/HelpController.php
@@ -106,7 +106,7 @@ public function helpPage($name) {
+      $build['#title'] = check_plain($info[$name]['name']);

Let's use String::checkPlain

ACF’s picture

Status: Needs work » Needs review
FileSize
1.01 KB

Added.

Status: Needs review » Needs work
Issue tags: -WSCCI Conversions, -London_2013_October

The last submitted patch, drupal8.help-module.2102453-10.patch, failed testing.

ACF’s picture

Status: Needs work » Needs review
Issue tags: +WSCCI Conversions, +London_2013_October

#10: drupal8.help-module.2102453-10.patch queued for re-testing.

The test that failed looks random as it is Drupal\system\Tests\File\RemoteFileUnmanagedMoveTest.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Perfect!

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.