Search code examples
drupaldrupal-6hookfbconnect

Drupal Hooks (hook_form_alter)


I’ve a question about Hooks. Being kind of new to Drupal I haven’t had much experience with hooks but a friend of mine suggested to get familiar with it and learn it to solve one of my problems on my site.

The thing is, that I have a module fbconnect which I use for users to connect via Facebook and use their profile picture at Facebook, on my site.

Everything is working, I’ve two checkboxes which and the connection and profile images works quite well but the problem is that above the two checkboxes I want a descriptive text to appear. The only way I so far have to put in this text is to create a “description” field to the first checkbox. Unfortunately, it chooses to display this text beneath the checkbox so now it look kind of strange with a checkbox, a 3-4 lines descriptive text to the entire Facebook function, and then another checkbox.

If hooks are the right way to go to solve this problem, how do I actually do it and where do I actually insert the hook? I can imagine that it is the hook_form_alter function I need to have and in my fbconnect module the function fbconnect_form_alter exists but where I go from here I really have no idea.

I’ve tried to read up and see some instruction videos about hooks but I’m still puzzled about this apparently very nice feature in Drupal. I'm using Drupal 6 for this site.

Any help or advice would be very much appreciated.


Solution

  • It sounds like you might also need to look at the Theme system in Drupal. In particular, take a look at theme_checkbox. From glancing at the code, there seems to be a label that is rendered after the actual checkbox. In your custom theme function or theme file you can try changing the order of the two.