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()
Comments
Comment #1
InternetDevels CreditAttribution: InternetDevels commentedHere is the patch.
Comment #3
InternetDevels CreditAttribution: InternetDevels commentedComment #4
dawehnerI can't see a reason why you want to check_plain here, given that it wasn't applied earlier.
Comment #5
vijaycs85@InternetDevels, we should use String::checkPlain(), if 2nd parameter of drupal_set_tiltle() is empty (or CHECK_PLAIN). That's how it works in D7.
Comment #6
ACF CreditAttribution: ACF commentedReroll using check_plain.
Comment #7
dawehnerYou could also directly use $this->t() instead of t().
Comment #8
vijaycs85Here is the updated title and patch that covers it.
Comment #9
dawehnerPerfect!
Comment #10
Wim LeersFix title.
Comment #11
catchCommitted/pushed to 8.x, thanks!
Comment #13
Eli-T