theme_menu_link() and drupal_pre_render_link() use the #href array key to specify a Drupal path that is passed as the second parameter for l($text, $path, $options).

Most places in core use the term “path” when referring to internal paths. I suggest renaming #href to #path.

drupal_pre_render_link() was added in #602522: Links in renderable arrays and forms (e.g. "Operations") are not alterable and theme_menu_link() in #283723: Make menu_tree_output() return renderable output.

Comments

c960657’s picture

StatusFileSize
new35.68 KB

Reroll.

dries’s picture

Issue tags: +Favorite-of-Dries

That makes a ton of sense, IMO. Let's see what the tests say.

rfay’s picture

subscribing. Not sure how this fits in the "no API/interface changes" period we're kind-of in.

sun.core’s picture

Version: 7.x-dev » 8.x-dev
Component: theme system » base system

Yes, it makes a ton of sense, but 1) it's 2-3 months past API clean-up freeze 2) breaks already ported modules and 3) we have a lot more pressing issues in the queue. If this would've been ready during slush, I would have RTBC'ed it immediately.

c960657’s picture

StatusFileSize
new26.8 KB
c960657’s picture

StatusFileSize
new27.54 KB
c960657’s picture

StatusFileSize
new28.07 KB

Status: Needs review » Needs work

The last submitted patch, href-path-6.patch, failed testing.

c960657’s picture

Status: Needs work » Needs review
StatusFileSize
new26.75 KB
dcam’s picture

StatusFileSize
new26.79 KB

Rerolled #9.

dcam’s picture

StatusFileSize
new26.79 KB

Rerolled #10.

Status: Needs review » Needs work

The last submitted patch, href-path-656614-11.patch, failed testing.

dcam’s picture

Status: Needs work » Needs review
StatusFileSize
new27.33 KB
new557 bytes

The migration of the email field into core introduced a new call to theme_menu_link().

dcam’s picture

#13: href-path-656614-13.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Favorite-of-Dries, +API clean-up

The last submitted patch, href-path-656614-13.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new37.47 KB

Just a global search/replace.

Status: Needs review » Needs work

The last submitted patch, path-656614-16.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new1.02 KB
new38.49 KB

Missed a couple bits in link.module

Sachini’s picture

Issue summary: View changes
StatusFileSize
new174.63 KB

Patch path-656614-18.patch re-rolled for 8.x
The patch applies cleanly at commit c75929755f2e0ad474db48a4ac580bc5b92f8c59

Status: Needs review » Needs work

The last submitted patch, 19: path_rerolled-656614-18.patch, failed testing.

miro_dietiker’s picture

Patch from #19 contains wrong merge conflict marks... Back to patch #18 then!

miro_dietiker’s picture

Status: Needs work » Needs review
StatusFileSize
new40.01 KB

Started with a new global search and replace.
And added link.module changes.

Unsure if i did replace too much. Let's see mr. bot! :-)

miro_dietiker’s picture

22: 656614_link_href_path_22.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 22: 656614_link_href_path_22.patch, failed testing.

miro_dietiker’s picture

Status: Needs work » Needs review
StatusFileSize
new39.85 KB

Reroll and apply replacement pattern to new matches for #href.

miro_dietiker’s picture

25: 656614_link_href_path_25.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 25: 656614_link_href_path_25.patch, failed testing.

miro_dietiker’s picture

Status: Needs work » Needs review
StatusFileSize
new37.48 KB

Trying a reroll. Some conversions are already in...

Status: Needs review » Needs work

The last submitted patch, 28: 656614_link_href_path_28.patch, failed testing.

miro_dietiker’s picture

Status: Needs work » Needs review
StatusFileSize
new36.91 KB

Rerolling.
Not that many #href remaining now that we have #route_name references, too.
Possibly there are some #path instances that should be converted to #route_name, too?
Guess there are still the same fails as before?

Status: Needs review » Needs work

The last submitted patch, 30: 656614_link_href_path_30.patch, failed testing.

miro_dietiker’s picture

Status: Needs work » Needs review
StatusFileSize
new36.49 KB

Rerolling and fixing. :-)

miro_dietiker’s picture

Dropping old attachments.

Status: Needs review » Needs work

The last submitted patch, 32: 656614_link_href_path_32.patch, failed testing.

miro_dietiker’s picture

Status: Needs work » Needs review
StatusFileSize
new37.07 KB

Nice. The previous failing are gone. Now all others fail.
So currently we need both (new) #path and (old) #href support on drupal_pre_render_link().

miro_dietiker’s picture

StatusFileSize
new931 bytes

Forgot the interdiff.

tim.plunkett’s picture

+++ b/core/includes/common.inc
@@ -2949,6 +2949,9 @@ function drupal_pre_render_link($element) {
   else {
     $element['#markup'] = l($element['#title'], $element['#href'], $element['#options']);
   }

Why would we keep this legacy support?

miro_dietiker’s picture

Patch at #30 switches away from #href to #path with the resulting 19 fails.
I didn't see how to fix those. Looks like the link field provides still #href instead of #path... Thought this might be by intention as an explicit href attribute.

Not sure if we even need all this conversion after the #route_name introduction.

tim.plunkett’s picture

While many of the #href/#path will be replaced with #route_name, we still need it for external links.

Status: Needs review » Needs work

The last submitted patch, 35: 656614_link_href_path_34.patch, failed testing.

realityloop’s picture

Status: Needs work » Needs review
StatusFileSize
new35.62 KB

Patch rerolled

realityloop’s picture

StatusFileSize
new36.75 KB

Found 2 more occurances

Status: Needs review » Needs work

The last submitted patch, 43: 656614_link_href_path_43.patch, failed testing.

realityloop’s picture

Status: Needs work » Needs review
StatusFileSize
new29.89 KB

reroll

Status: Needs review » Needs work

The last submitted patch, 46: 656614_link_href_path_46.patch, failed testing.

realityloop’s picture

Status: Needs work » Needs review
StatusFileSize
new33.81 KB

reroll attached

realityloop’s picture

Issue tags: +Amsterdam2014
yesct’s picture

Status: Needs review » Reviewed & tested by the community

Read through the patch, I dont see anything wrong with this. :)

tim.plunkett’s picture

I think this will conflict with #2277103: Switch Drupal::l() and LinkGenerator to expect a Url object, let's make sure that goes in first (since its a beta blocker).

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 48: link_href_path-656614-47.patch, failed testing.

realityloop’s picture

Status: Needs work » Needs review
StatusFileSize
new31.92 KB

@277103 is marked as fixed, here is a reroll

Status: Needs review » Needs work

The last submitted patch, 53: link_href_path-656614-53.patch, failed testing.

realityloop’s picture

Status: Needs work » Needs review
StatusFileSize
new33.73 KB

@alexpott pushed a commit that stopped theis from applying, another reroll.

dawehner’s picture

Well, actually #2347465: Convert all instances of #type link/links to convert to use routes should kill all instances of #href, sorry.

pwolanin’s picture

Also, any case using #href would refer to a URI, not a path, so I think this should be closed.

dawehner’s picture

Status: Needs review » Closed (duplicate)

Yeah, thank you for your work on this issue though!