Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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()
Related Issues
Comment | File | Size | Author |
---|---|---|---|
#9 | drupal8.config-module.2102443-9.patch | 1.34 KB | disasm |
#9 | interdiff.txt | 477 bytes | disasm |
#7 | drupal8.config-module.2102443-7.patch | 1.42 KB | disasm |
#7 | interdiff.txt | 716 bytes | disasm |
#5 | drupal8.config-module.2102443-5.patch | 1.11 KB | disasm |
Comments
Comment #1
vijaycs85Initial 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.)
Comment #3
rteijeiro CreditAttribution: rteijeiro commentedRe-rolled.
Comment #5
disasm CreditAttribution: disasm commentedTackling 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().
Comment #7
disasm CreditAttribution: disasm commentedTry that again without the missing use flag for ControllerBase.
Comment #8
dawehnerThis is one newline too much :P
Comment #9
disasm CreditAttribution: disasm commentedRemoved!
Comment #10
dawehnerThank you
Comment #11
catchCommitted/pushed to 8.x, thanks!