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

InternetDevels’s picture

Status: Active » Needs review
FileSize
1.77 KB

Status: Needs review » Needs work

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

InternetDevels’s picture

Status: Needs work » Needs review
FileSize
1.75 KB
dawehner’s picture

+++ 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.

vijaycs85’s picture

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

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

This is looking great now.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

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