Can views accommodate a name attribute for links when outputting fields as links? This would allow for better integration with jquery tools such as colorbox and simple dialog that use all of the possible attributes of the a anchor tag.

It would be great to be able to add something like name="my text string" to a link rendered by views.

I've attached a snapshot of the output fields as a link popup to give more context.

Comments

ravi.kumar88’s picture

StatusFileSize
new1.52 KB
new43.92 KB

There are two alternatives to achieve this:
1. Instead of selecting "Output this field as a link" choose "Rewrite the output of this field" and in the text write as below:
<span name="desired_name">[title]</span>
where [title] is one of the rewrite pattern (you can choose any).
2. By applying the patch you will be able to get a Name field under the "REWRITE RESULT ->Output this field as a link" as shown in screen shot.Just insert the name of the field that will be assigned as an attribute to the field.

Mołot’s picture

Status: Active » Needs review

Setting status to "needs review" to get testbot's evaluation of above patch.

Status: Needs review » Needs work

The last submitted patch, 1977100.patch, failed testing.

Mołot’s picture

Status: Needs work » Needs review

#1: 1977100.patch queued for re-testing.

Mołot’s picture

Version: 7.x-3.7 » 7.x-3.x-dev

Patch works for 7.x-3.7
Changing do dev and re-testing to see if it can be readily applied there.

Mołot’s picture

#1: 1977100.patch queued for re-testing.

rv0’s picture

even more fun would be completely custom attributes, to support HTML5 data attributes

Yuri’s picture

Issue summary: View changes

The patch does not apply well.

Yuri’s picture

The option to use "Rewrite the output of this field" also does not work for example rel="width:500"
The width: is stripped out.

chris matthews’s picture

StatusFileSize
new1.51 KB

Removed the trailing whitespace on lines 33 and 38 of the patch in #1 to views_handler_field.inc.