Updated: Comment 0

Problem/Motivation

#2047633: Move definition of menu links to hook_menu_link_defaults(), decouple key name from path, and make 'parent' explicit removes the title support out of hook_menu() so we need _title and _title_callback on all our routes.

Proposed resolution

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
38.97 KB

This is a starter

Status: Needs review » Needs work

The last submitted patch, 1: title-2143933.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
44.42 KB
5.96 KB

So, this will override all drupal_set_title calls. I fixed a couple for now...

The last submitted patch, 3: title-2143933-3.patch, failed testing.

catch’s picture

Note there's #1830588: [META] remove drupal_set_title() and drupal_get_title() for removing drupal_set_title() calls - many of the sub-issues have patches and some are RTBC (I'll try to clean out the RTBC ones next time I'm going through the queue).

tim.plunkett’s picture

FileSize
52.91 KB
10.42 KB

@catch it seems very few of those actually address the problems here...

So BreadcrumbTest was still asserting that a menu link title could override a page title from hook_menu. But now that its a route title, it shouldn't be possible.

pwolanin’s picture

So, I looked through a lot of the yml files and didn't see any obvious omissions and it's close to RTBC.

One trivial problem I saw was some inconsistency about quoting strings in the YAML files.

e.g.

_title: 'Delete' 

vs.

_title: Settings

while quoting is probably not required in any case, I think it makes for a clearer meaning, so this change quotes titles that were not quoted, and fixes in views_ui.routing.yml one _title with a mismatched quote mark.

Also, in core/modules/node/node.pages.inc the call to drupal_set_title() uses PASS_THROUGH but other calls do not. This needs to be checked - either that's wrong since the title will now be escaped, or other cases are emitting the title unsanitized.

dawehner’s picture

Also, in core/modules/node/node.pages.inc the call to drupal_set_title() uses PASS_THROUGH but other calls do not. This needs to be checked - either that's wrong since the title will now be escaped, or other cases are emitting the title unsanitized.

I know that the various drupal_set_title() issues really take care about escaping and not escaping. This should not be part of this patch, if possible, as it adds a quite big amount of complexity.

tim.plunkett’s picture

I added Xss::filter() where appropriate in the patch. It passes, and leaves the rest of the drupal_set_titles to their respective issues. I only changed as much as I had to.

RTBC?

larowlan’s picture

pwolanin’s picture

@tim.plunkett - there are a couple shifts directs from drupal_set_title() to using #title in the patch - possibly those should be omitted fro this patch. I agree the ones switching to title callback should be fine.

tim.plunkett’s picture

If you switch them back, tests will fail.

dawehner’s picture

Assigned: dawehner » Unassigned
Status: Needs review » Reviewed & tested by the community

Awesome work tim.

This blocks hook_menu(), so let's better get this in rather sooner than later and see how many remaining failures we still have.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Patch seems fine and yay for killing hook_menu() and a critical both, but...

41 files changed, 205 insertions, 82 deletions.

Was quite surprised about this. I figured it would be more of a 1:1 ratio, but instead it seems we're adding titles *far* more often in routes than we needed to do in the D7 version. Hm. :\

Especially for entities, it seems suboptimal to have to enter those titles by hand. I could see contrib ending up a smörgåsbord of "Create foo" and "Add foo" and "Add new foo" and whatnot. Is this worth discussing in a follow-up?

At any rate, committed and pushed to 8.x to move things along. Thanks!

pwolanin’s picture

@webchick - I suspect many of the old hook_menu entries were not removed here, since we will kill them all later.

e.g. aggregator_menu() was still left with a lot of title entries.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.