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 |
---|---|---|---|
#25 | 2102465-page-title-node-25.patch | 685 bytes | webwarrior |
#18 | 2102465-page-title-node-18.patch | 5.98 KB | ACF |
#16 | 2102465-page-title-node-16.patch | 5.98 KB | ACF |
#14 | 2102465-page-title-node-14.patch | 6.66 KB | vijaycs85 |
#14 | 2102465-diff-13-14.txt | 1.07 KB | vijaycs85 |
Comments
Comment #1
InternetDevels CreditAttribution: InternetDevels commentedComment #3
sidharthapre-roll patch
Comment #4
cosmicdreams CreditAttribution: cosmicdreams commentedlooks good and should still apply
Comment #5
cosmicdreams CreditAttribution: cosmicdreams commented#3: drupal-node_remove_drupal_set_title_2102465-3.patch queued for re-testing.
Comment #7
cosmicdreams CreditAttribution: cosmicdreams commentedspoke too soon needs a reroll
Comment #8
vijaycs85Another re-roll from #1
Comment #10
vijaycs85Seems valid fails
D7:
drupal_set_title('My title');
D8
$page['#title'] = String::checkPlain('My title');
Whereas
D7
drupal_set_title('My title', PASS_THROUGH);
D8:
$page['#title'] = 'My title';
Updating patch to do this (seems it was doing the opposite).
Also reverting changes in node_revision_overview() as the whole function will be removed as part of #1863906: [PP-1] Replace content revision table with a view
Comment #11
tim.plunkettThis is going to double escape, @ runs checkplain
This is not needed, since we KNOW that "Add content type" is clean
Comment #12
dawehnerThis should be the full namespace.
We do have a NodeTypeInterface
This basically check plains twice.
Looks perfect
Comment #13
vijaycs85Thanks for the quick review. here is update.
#11.1 - fixed
#11.2 a) it is conversion of what we have in D7 b) t() can bring anything in.
Comment #14
vijaycs85Thanks for the review @dawehner. Here is the updates:
#12.1 fixed
#12.2 fixed
#12.3 fixed - duplicate of #11.1
#12.4 thanks :)
Comment #16
ACF CreditAttribution: ACF commentedReroll, tested locally and passes tests.
Comment #17
dawehnerThe amount of spaces is just too damn high.
Comment #18
ACF CreditAttribution: ACF commentedOops, hopefully fixed now.
Comment #19
vijaycs85Updating tag...
Comment #20
dawehnerPlease try to post interdiff before: https://drupal.org/documentation/git/interdiff
Comment #21
dawehner... But actually my goal was to set this to RTBC.
Comment #22
ACF CreditAttribution: ACF commentedApologies for the lack of interdiff.
Comment #23
catchCommitted/pushed to 8.x, thanks!
Comment #25
webwarrior CreditAttribution: webwarrior commentedShouldn't the other drupal_set_title also be removed ?
Comment #26
vijaycs85Good catch @webwarrior. Manually tested this patch and it works. Inside form() method the title for preview page is handled. So it is safe to remove.
Comment #27
dawehner+1
Comment #28
webchickCommitted and pushed to 8.x. Thanks!