Link is almost perfect for my use case, but I need the following functionality and—perhaps because of my ignorance and inexperience—I can't figure out how to do it with the present build:

Custom rel Attributes
Obviously it is possible to set a rel attribute that is applied to every use of a given Link field, but I need to be able to use literally hundreds of different rel attribute configurations and I'd rather not make hundreds of Link fields to do it. If there's a sleek workaround, I'd love to hear about it! Otherwise, I'd like to see a future build with the ability to add distinct rel attributes to each piece of content using a Link field.

Custom CSS Classes
This one isn't as important, because I only have five different CSS classes that I want to apply. Worst case scenario, I'll wind up making five different Link fields, each with a different CSS class associated with it. Again, though, I'd love a better workaround or a future build with the ability to modify or add CSS classes in each piece of content, rather than adding it to the field itself.

Thank you for your help!

Comments

jcfiala’s picture

Hmm...

Is this a case where having a rel and a css field to enter data into on each node would be useful?

You could probably nick something together by creating a text field, setting it so it doesn't display, and then on the hook_node_presave write the value from the text field into the link data...

This is something I'd like to provide, but first I'd really like to get the module ready with just the functionality we had before. That having been said, I'm interested in seeing patches on this.

Tomyris’s picture

Yes, having a rel and CSS field on each node is exactly what I would like to see.

I literally just started reading about Drupal, PHP and all of the rest about a week ago, so a patch may be out of my depth. I'll poke around, though, and hopefully someone else with more expertise than I will be interested in this functionality as well. Thanks for your reply!

reglogge’s picture

subscribe

beatnbite’s picture

I have a content type that should display some links below the node text. There are different link types which should by styled differently. The problem is that it is unknow how many links there will be (so I need one "unlimited" Link field and can't split the links into multiple Link fields), how they will be ordered and what types they will have. The ability to set a CSS class per link would help.

dqd’s picture

Priority: Normal » Minor
Status: Active » Closed (works as designed)

like I already sad in many other issues here:

This is not really good code design and leads away from the level we have reached in modular framework design and flexibility with D7.

This issue here is not about storing and validating link data, it is about markup. There are hundrets of modules out there keeping the flexibility of the stored data to its best by applying markup for any different use case (rules, tokens, types, tags, user actions) afterwards.

I am pretty sure that many agree with me, that this is up to personal set up in manage fields and will not find its way into link module ...

Thanks for all thoughts and contribution. It is much appreciated.

manjiri.limaye’s picture

Issue summary: View changes

How can I achieve this using the modules mentioned (rules, tokens, types, tags, user actions). I need separate rel for each link because for few links I want to open that in lightbox and few to open as per the target defined.

manjiri.limaye’s picture

Priority: Minor » Critical
Status: Closed (works as designed) » Needs work

I need to implement this functionality in my project.

Michelle’s picture

Priority: Critical » Minor
Status: Needs work » Closed (works as designed)

Setting the status back to what it was since there is no patch and the request was already rejected. That said, this functionality seems to have made its way into the module but isn't working correctly, which is how I ended up here. I was hoping there was a patch here to fix it since it was marked "needs work" but it looks like that was just a mistake so I will keep searching.