Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Drupal - Put form in hook_page_build

  • 20-07-2015 11:14AM
    #1
    Registered Users, Registered Users 2 Posts: 4,260 ✭✭✭


    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, Registered Users 2 Posts: 4,260 ✭✭✭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