Currently it's possible to display the url of a cck link field in Views, but it's not possible to display the title, separate from the url. This might be needed in cases where you want to overwrite the output of the field, to alter things like the link target or class. Attached patch adds this feature.

Cheers,
Stella

Comments

brian_c’s picture

I would really like to see the ability for Link to output just the title.

Then you would be able to output title and URL as two separate fields in a view, and use Rewrite Output to do anything you want with their values right from the Views UI, no theming required.

A typical use case is when you DON'T want the title to actually be the link, you want it to just be a label with a "Click Here" link or something displayed underneath.

maijs’s picture

Version: 6.x-2.6 » 6.x-2.x-dev
Category: feature » task
StatusFileSize
new1.24 KB

I created a new formatter "Title, as plain text" which does just that - returns a plain text of the title (without surrounding tags), if empty - empty string. Can be used as a replacement pattern on other fields.

stella's approch is to expose a field only in Views. This approch is to make plain link title available everywhere where it's displayed - within Views or without.

maijs’s picture

StatusFileSize
new1.24 KB

Update: Sorry, Drupal thrown an error on me, patch in #2 leads nowhere, this one in #3 seems to be fine.

JoeMcGuire’s picture

Status: Needs review » Reviewed & tested by the community

Works well providing a new "Title, as plain text" field formatter appearing for both display fields and views

jcfiala’s picture

Assigned: Unassigned » jcfiala

Assigning to myself so I can find this faster.

jcfiala’s picture

Status: Reviewed & tested by the community » Fixed

Okay, good job. I've added this to the link module and it will be in the next release.

Status: Fixed » Closed (fixed)

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

wapnik’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Closed (fixed) » Needs review
StatusFileSize
new1.17 KB

I needed this in 7.x version so rerolled and tested.

Jason Dean’s picture

hey wapnik

just what I needed - thanks!

jcfiala’s picture

Status: Needs review » Needs work

Sadly, the patch no longer applies cleanly due to having had to prepend 'link' to all of the formatter names.

That being said, I can use it to guide building out the title formatter.

jcfiala’s picture

Status: Needs work » Fixed

Okay, I made the change, added a test in LinkAttributeCrudTest to make sure it was working, and committed.

Should show up in the next version, or -dev soonish.

dqd’s picture

jcfiala++

dqd’s picture

Issue tags: +scheduled for beta1

marked 4 beta release

Status: Fixed » Closed (fixed)
Issue tags: -scheduled for beta1

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