0

My requirement is that in my custom content type page, I need to add fields that link to facebook and twitter. This is easily do-able as two textboxes which contain the hyperlinks to the two site urls. However the way I want it is that, if there is a facebook URL added, in the display it should show a facebook icon clicking on which will take the user to the facebook URL, same with twitter. (It is not for sharing my page content in facebook, but for redirecting the user to facebook link provided - same with twitter)

I would like these two to be two standard fields in the content type so that added links to these two will trigger this behaviour. If the textboxes are empty, the icons will not show up.

Any pointers on how this can be achieved? I looked at the various social share modules in drupal, but most of them are for sharing/tweeting the page inside which they are added.

I appreciate any help...

1 Answer 1

1

You can use Link module to create facebook or twitter url field for your content type.

The link module can be count to the top 50 modules in Drupal installations and provides a standard custom content field for links. 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.

For facebook or twitter icon, you need to manage this through css or need to add extra field for icon and display node.tpl.php if there is value for the link field.

0

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