I'm using colorbox to display a user-registration from using a /colorbox/form/user-register-form link with the standard options and the colorbox-load class. This works fine. However, I want to alter the form if I'm displaying it within a colorbox and leave it un-altered otherwise.

I'd like to know whether the form is being displayed at a page such as /user/register or within another page as a colorbox form. I realise I could build a create a new form using user-register-form as a template but I'd prefer to just use hook_form_alter() to modify it.

My question is whether there is a way to determine whether a form is being displayed within a colorbox within hook_form_alter? colorbox_form_page() just spits out the drupal_get_form($form_name) maybe you could "tag" it with some property, attribute or class that we could look for in hook_form_alter??

Comments

frjo’s picture

Check out colorbox_form_alter() in colorbox.module and you can see how I use arg() to do this.

frjo’s picture

Status: Active » Closed (won't fix)

Form support will most likely be moved from Colorbox module to the new Modal forms module.

http://drupal.org/sandbox/frjo/1095052