I'm writing a ctools content-type plugin to use it as a panels pane. In my plugin code I try to use the form_alter hook at render for the login_form (not for the edit forms). But the hook seems not to be called. It makes no difference if I use the generic form_alter hook or the particular with the form-id in the function name. Both work neither.

 * Modify the User Login form
function justloginpane_content_type_form_user_login_alter(&$form, &$form_state, $form_id) {

  drupal_set_message("Form ID is : " . $form_id);

  $form['description'] = array(
    '#type' => 'item',
    '#title' => t('A form with a fieldset'),

    // Enable AJAX
    $form['actions']['submit']['#ajax'] = array(
                                  'callback' => 'ajax_example_submit_driven_callback',
                                  'wrapper' => 'box', 
    $form['actions']['submit']['#value'] = 'TESTSUBMITTEXT';


I thought it worked once, but I'm not really sure.

  • 1
    Where is the code? It needs to either be in the .module file, or another file which is explicitly required/included into the .module file. Otherwise Drupal won't find it – Clive Sep 19 '14 at 11:45
  • Like @Clive said, you're probably writing the alter function in the .inc file of your plugin folder. Move it to the module file, or include the plugin file from the module file. – AjitS Sep 19 '14 at 11:47
  • Yes it's in the .inc file. I'll try moving it to the .module file. – MikeB25 Sep 19 '14 at 13:50
  • @Clive and @AjitS: it's also not called if I put the function in the .module file. My module's name is justloginpane and the alter function's name is justloginpane_form_user_login_alter – MikeB25 Sep 19 '14 at 14:04

Your Answer

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

Browse other questions tagged or ask your own question.