Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Drupal - Put form in hook_page_build

Options
  • 20-07-2015 11:14am
    #1
    Registered Users Posts: 4,258 ✭✭✭


    I'm trying to create a form that's displayed as a popup when the function is called.

    I'm trying to do this using hook_page_build
    
    
    
    
    salesforcedara_form($form, &$form_state) {
      
     $form['trek'] = array(
        '#type' => 'textfield', //you can find a list of available types in the form api
        '#title' => 'Please enter your TREK serial number',
        '#required' => TRUE, //make this field required 
      );
      
    
    $form['submit_button'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
      );
      
      return $form;
    }
    
    ////////////////////////////////////////////////////////////
    
    /*
    ** Implements hook_page_build
    */
    
    function salesforcedara_page_build(&$page) {
     
        // We are on a node detail page. Append a standard disclaimer to the
        // content region.
        $page ['content']['form'] = array(
          '#markup' => t('TREK serial number validater'),
          '#weight' => 25,
        );
      
    }
    
    


Comments

  • Moderators, Society & Culture Moderators Posts: 17,642 Mod ✭✭✭✭Graham


    Did you just stop by to let everyone know you're working on a form or did you forget to attach a question?


  • Registered Users Posts: 4,258 ✭✭✭swingking


    Sorry my question is why isn't this working.

    I have everything setup correctly.

    It just refuses to run the form as a pop up.

    Thanks


Advertisement