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.
Updated: Comment 0
Problem/Motivation
Since #2032535: Resolve 'title' using the route and render array we can return dynamic titles using the render array.
Proposed resolution
Use both the dynamic title in the render array but also register the static title for convenience.
Remaining tasks
None
User interface changes
None
API changes
None
Related Issues
Comment | File | Size | Author |
---|---|---|---|
#4 | 2067931-4.patch | 7.36 KB | damiankloip |
#4 | interdiff-2067931-4.txt | 1.27 KB | damiankloip |
#1 | vdc-2067931-1.patch | 6.08 KB | dawehner |
Comments
Comment #1
dawehnerAdding wscci tag and the patch.
Comment #3
damiankloip CreditAttribution: damiankloip commentedShould we always just set this, regardless of whether it's empty of not? What will the default be otherwise?
Comment #4
damiankloip CreditAttribution: damiankloip commentedRerolled, and fixed the ViewPageControllerTest. I think if we are returning a render array only now, we can just check all the keys we expect are present?
The only other failure now should be the HTTPStatusCode area handler. As it currently relies on setting the statusCode on the response, which we were returning, but not anymore. So we need to deal with this differently.
Comment #5
dawehnerWe could just wait on the HtmlPage patch, which will bring for example http status codes as well. An alternative approach would be to convert the existing usages of changing the response object (content-type for rss/status code for http status code area handler) to use a kernel event subscriber.
Comment #7
damiankloip CreditAttribution: damiankloip commentedCould do that, then we would need a view subscriber and a new method that the subscriber would check?
Comment #8
dawehnerWell, I guess the subscriber would just get the response object and pull it from there?
Comment #9
catchBumping to major, this looks like it needs updating for Twig autoescape/safe markup.
Found this issue via #2214525: Remove unused Drupal\Core\Utility\Title - this is the only remaining use of that.
Comment #10
Wim LeersRelated: #2359901: Discourage $main_content['#title'] in favor of route titles and title callbacks.
Comment #11
dawehnerMost of this is fixed in views already anyway. The related issue is not important for views
Comment #12
xjmMarking duplicate then for whatever has been fixed in Views since nothing went in through this issue.
Comment #13
BerdirThere is still a broken usage of a Utility\Title constant left in Drupal\views\Plugin\views\area\Title but I think we can remove that in #2214525: Remove unused Drupal\Core\Utility\Title, please confirm.