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

vijaycs85’s picture

Status: Active » Needs review
FileSize
1.81 KB

Initial patch:

Notes:
1. I guess we may need to replace _controller: '\Drupal\config_test\ConfigTestController::edit with _form: '\Drupal\config_test\ConfigTestFormController' as we needed callback just to set the title. thought it is not part of this page.

2. Not sure how are we handling the second param of drupal_set_title(). (i.e. PASS_THROUGH here.)

Status: Needs review » Needs work

The last submitted patch, 2102443-config_test-title-1.patch, failed testing.

rteijeiro’s picture

Status: Needs work » Needs review
FileSize
1.81 KB

Re-rolled.

Status: Needs review » Needs work

The last submitted patch, 2102443-config_test-title-3.patch, failed testing.

disasm’s picture

Status: Needs work » Needs review
FileSize
1.11 KB

Tackling this an different way. title callbacks should be used very sparingly. There's no reason we can't just throw #title on the form itself here. Also, \Drupal::entityManager is ugly, so taking the opportunity to change that to $this->entityManager().

Status: Needs review » Needs work

The last submitted patch, drupal8.config-module.2102443-5.patch, failed testing.

disasm’s picture

Status: Needs work » Needs review
FileSize
716 bytes
1.42 KB

Try that again without the missing use flag for ControllerBase.

dawehner’s picture

+++ w/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestController.php
@@ -60,3 +62,5 @@ function disable(ConfigTest $config_test) {
+
+

This is one newline too much :P

disasm’s picture

Removed!

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you

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.