We've got a bit of code internally that we've posted about before:
http://www.computerminds.co.uk/views-display-block-linked-title
That makes it really simple to link the title of a block to a page display in the same view, it is a descendant of the block plugin that ships with views and we've just added a little more functionality so that you can make your block title link to any old place you like.

We'd like to contribute this functionality back to the community, but it seems almost too small of a feature to be its own module, if we supplied a patch to views, would that be accepted? It adds another option to the block specific settings on the views UI side, and so would be another thing for users to contend with when getting used to views.

What should we do with our code!?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

I would consider this as a patch. Linking blocks is to views is a common feature request, so this seems reasonable to include in Views.

Steven Jones’s picture

Status: Active » Needs work
FileSize
7.52 KB

Here's a first pass at adding this functionality. Needs a bit of work.

stella’s picture

Status: Needs work » Needs review

This works great, thanks! I did a quick review of the code and it looks good - what areas need additional work?

ManyNancy’s picture

Subscribe, could somebody please take a look at this?

merlinofchaos’s picture

Status: Needs review » Needs work

The use of enums (defines) is unnecessary here. Just use string identifiers, they're more than portable and will survive changes in the future better.

I can't think of a good use case for the link display being different than the global link display, so I don't think we want a setting for that, though if there's a good argument to be made about this being better UI, I will consider it.

That has the benefit of getting rid of the function with the @todo that says it doesn't work.

If somebody would like to clean this up it would be a valuable addition.

Steven Jones’s picture

I'll be honest, and say I'm not entirely sure why I didn't use the linked display, but I think it's because you can't assume that the linked display will have a path for the link to point at, so that's why there was some custom code to find the displays that are at a path (and thus make sense to have a link to).

Steven Jones’s picture

Status: Needs work » Needs review
FileSize
5.35 KB

Right, so attached is a patch that:

  1. Ditches those 'defines' and uses strings as requested.
  2. Uses the 'Link display' for the display to link to.

But does the original functionality of linking a block's title to a view or some path.

castle9mm’s picture

@#7 I've applied the patch and all is working well except for one "Custom URL". In my setup, I'm needing to link the title of the view_display_block to another view with filter arguments however the query string is ending up encoded.

I.e Custom URL
"calendar/all?group_nid[]=%1" ends up as
"calendar/all%3Fgroup_nid[]%3D9" on click through which breaks the receiving view page.

Any ideas how I can get the query parameters to pass through?

Summit’s picture

Subscribing, greetings, Martijn

merlinofchaos’s picture

Status: Needs review » Needs work

We should probably do a parse_url like we do in link rewriting so that we can have query strings and fragments in the link.

grubstarstar’s picture

I tried to do exactly the same thing. Has anyone found a solution to this? It would be a handy feature and I can't find another way to do it!

fletchgqc’s picture

I was surprised to find that this functionality was not in views already. Linking a block title to the page display is so logical that it should really be the default behaviour. Hope your patch works out.

LandonAB’s picture

Is this being worked on for 7 also or is the functionality there and I am missing it?

dawehner’s picture

No there is no work going on for this feature.

spgd01’s picture

Why is not add this to views?

MustangGB’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)