0

I have created a "button" class in my style.css file.

I can easily create a button by assigning the "button" class to it. I can do this when I write the html code in, say, a block that I place wherever on the page.

But how do I transform an existing link (like one automatically created by a module) into a button?

Do I need to hack the module?

Any help on this riddle would be greatly appreciated.

Thanks.

:)

4
  • 1
    What is generating the link you want to change?
    – digital
    Jan 7 '14 at 17:17
  • Like @digital said, we need to know what link is being generated. Jan 7 '14 at 17:33
  • Well, I was thinking of Privatemsg for instance. To write a new message, there is a link in the inbox that I would like to transform into a button.
    – user14666
    Jan 7 '14 at 22:10
  • Do you know if this is a menu item or link inserted into a template? If it's a menu link then you could take a look at api.drupal.org/api/drupal/modules!system!system.api.php/…
    – digital
    Jan 8 '14 at 9:14
0

I definitely don't recommend hacking the module - it's not good Drupal form, and it limits your ability to get module updates in the future.

I think the answer depends on how the module creates the link in question. That is, how is the link HTML being generated? If it's being generated and printed directly to the screen, then you'd have to do some CSS/JS work to intercept the HTML being generated and alter it. We have done this when necessary on our site to bend certain modules and functionality to suit our display needs. If the link has a specific ID, just alter it with JS in a custom module or custom theme. If not, you may have to get at it via jQuery based on what elements it's contained within, but it can be done.

If you're lucky and the module is well-written, the link will be part of content that's passed through Drupal's theming engine first through a theme() call. In this case, you can write your own function to grab anything being themed, inspect it for whatever markers indicate that it should become a button, and then alter the link code as need be. If you're not familiar with the theme() functionality in Drupal, you'll want to read up on it on Drupal.org first. Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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