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()

Files: 
CommentFileSizeAuthor
#5 2102461-drupal-remove_drupal_set_title_in_menu_module-5.patch1.75 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 58,422 pass(es).
[ View ]
#5 2102461-diff-3-5.txt639 bytesvijaycs85
#3 drupal-remove_drupal_set_title_in_menu_module-2102461-3.patch.patch1.75 KBInternetDevels
PASSED: [[SimpleTest]]: [MySQL] 58,832 pass(es).
[ View ]
#1 remove_drupal_set_title_in_menu_module-2102461-1.patch1.77 KBInternetDevels
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch remove_drupal_set_title_in_menu_module-2102461-1.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new1.77 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch remove_drupal_set_title_in_menu_module-2102461-1.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Status:Needs review» Needs work

The last submitted patch, remove_drupal_set_title_in_menu_module-2102461-1.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1.75 KB
PASSED: [[SimpleTest]]: [MySQL] 58,832 pass(es).
[ View ]

+++ b/core/modules/menu/lib/Drupal/menu/MenuFormController.php
@@ -70,7 +70,7 @@ public function form(array $form, array &$form_state) {
-      drupal_set_title(t('Edit menu %label', array('%label' => $menu->label())), PASS_THROUGH);
+      $form['#title'] = t('Edit menu %label', array('%label' => $menu->label()));

We could use $this->t() instead of t() directly here.

StatusFileSize
new639 bytes
new1.75 KB
PASSED: [[SimpleTest]]: [MySQL] 58,422 pass(es).
[ View ]

There are other instance in this form with t(), but just replacing the one that is related to drupal_set_title().

Status:Needs review» Reviewed & tested by the community

This is looking great now.

Status:Reviewed & tested by the community» Fixed

Committed/pushed to 8.x, thanks!

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