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 | 2102449-follow-up-9.patch | 707 bytes | amateescu |
Comments
Comment #1
swentel CreditAttribution: swentel commentedComment #2
vijaycs85All good, except the minor note below:
Not sure how are we going to handle PASS_THROUGH in D8.
RTBC from my side.
Comment #3
swentel CreditAttribution: swentel commentedWell, we don't want check_plain here, so we're good. I guess if we need it, we'll have to call check_plain() again.
Comment #4
catchCommitted/pushed to 8.x, thanks!
Comment #6
tstoecklerPretty sure this change was wrong. I.e. the title needs to be added back somewhere else. This currently only works because the hook_menu() menu item has a 'title' and if '#title' is not set and the title resolver doesn't return anything either, drupal_get_title() is called which checks the menu item title. I guess simply adding $form['#title'] would be the easiest.
Comment #7
swentel CreditAttribution: swentel commentedI don't see what's wrong with it for now - there's a 'title callback' => 'entity_page_label' in hook_menu() - that's just fine no ?
Having to add '#title' everywhere just sounds plain ridiculous.
Comment #8
tstoecklerWell hook_menu() is only for menu links now. That should not be relied on for the actual page output. The fact that it currently works is only an artefact of legacy code. I'm not going to judge whether that is ridiculous or not, but that's simply how things are at the moment. Unless I'm completely missing something, needless to say.
Comment #9
amateescu CreditAttribution: amateescu commented@tstoeckler is right, we need a $form['#title'] because that hook_menu() entry that has a title callback is going away soon in #2111823: Convert field_ui / Entity local tasks to YAML definitions.
Comment #10
swentel CreditAttribution: swentel commentedComment #11
catchCommitted/pushed to 8.x, thanks!