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!?
Comment | File | Size | Author |
---|---|---|---|
#7 | views-614944.patch | 5.35 KB | Steven Jones |
#2 | views-614944.patch | 7.52 KB | Steven Jones |
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedI would consider this as a patch. Linking blocks is to views is a common feature request, so this seems reasonable to include in Views.
Comment #2
Steven Jones CreditAttribution: Steven Jones commentedHere's a first pass at adding this functionality. Needs a bit of work.
Comment #3
stella CreditAttribution: stella commentedThis works great, thanks! I did a quick review of the code and it looks good - what areas need additional work?
Comment #4
ManyNancy CreditAttribution: ManyNancy commentedSubscribe, could somebody please take a look at this?
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedThe 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.
Comment #6
Steven Jones CreditAttribution: Steven Jones commentedI'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).
Comment #7
Steven Jones CreditAttribution: Steven Jones commentedRight, so attached is a patch that:
But does the original functionality of linking a block's title to a view or some path.
Comment #8
castle9mm CreditAttribution: castle9mm commented@#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?
Comment #9
Summit CreditAttribution: Summit commentedSubscribing, greetings, Martijn
Comment #10
merlinofchaos CreditAttribution: merlinofchaos commentedWe should probably do a parse_url like we do in link rewriting so that we can have query strings and fragments in the link.
Comment #11
grubstarstar CreditAttribution: grubstarstar commentedI 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!
Comment #12
fletchgqc CreditAttribution: fletchgqc commentedI 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.
Comment #13
LandonAB CreditAttribution: LandonAB commentedIs this being worked on for 7 also or is the functionality there and I am missing it?
Comment #14
dawehnerNo there is no work going on for this feature.
Comment #15
spgd01 CreditAttribution: spgd01 commentedWhy is not add this to views?
Comment #16
MustangGB CreditAttribution: MustangGB commented