0

I'm trying to add a button or a link (< a href=''>< /a> or a < button>< /button>) in a new column in my field collection. For the moment i have 3 fields added by the administration of my field collection. I searched for add a button by the administration but we can't. what the best tips to add a button in a new column of my field collection ?

Do i need to "foreach" all element of my field collection and add a new element with the HOOK_form_alter ?

Here an example with the actual view (i cut the "delete line button" here so there aren't on the picture):

enter image description here

And now what i wanna create :

enter image description here

The "button" can be a link and after with css i style him.

PS : the button appear on edit content form

Thanks !

2
  • It looks like you are using Bootstrap type theme? By button, what do you mean? Do you want to add <button> tag? Commented Jan 5, 2015 at 15:05
  • i mean add a button like <a href="..."></a> or a <button></button> to go to another page
    – Cracs
    Commented Jan 5, 2015 at 15:07

1 Answer 1

1

Use the Link Module to add a link field to your field collection

With this module links can be added easily to any content types and profiles and include advanced validating and different ways of storing internal or external links and URLs. It also supports additional link text title, site wide tokens for titles and title attributes, target attributes, css class attribution, static repeating values, input conversion, and many more.

And add the relevant bootstrap class to the output through the manage display UI.

5
  • Will OP be able to construct links using tokens? Commented Jan 5, 2015 at 15:19
  • Can't think of any reason why not @J.Reynolds, though admittedly I haven't tried it
    – Clive
    Commented Jan 5, 2015 at 15:19
  • Ok i will try the "link" module ! after i will need to add the bootstrap class with Hook form alter right ?
    – Cracs
    Commented Jan 5, 2015 at 15:38
  • The link module actually lets you specify a class for the link through the UI (in the Manage Display screen), so you shouldn't have to write any code for this at all
    – Clive
    Commented Jan 5, 2015 at 15:39
  • Ok the module is working but i want to show the button in edit content form and not in the view of the content :/ there is a solution with "link" module ? thanks
    – Cracs
    Commented Jan 5, 2015 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.