I'm trying to include a module form in a panel and I've tried using drupal_get_form(), but not sure I'm using it correctly.

In the organic groups module, there's a function to render an og_broadcast_form. It's called within a page_callback in og.module:

        // Broadcast tab on group node.
      $items['node/%node/broadcast'] = array(
        'title' => 'Broadcast',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('og_broadcast_form', 1),
        'access callback' => 'og_broadcast_access',
        'access arguments' => array(1),
        'type' => MENU_LOCAL_TASK,
        'file' => 'og.pages.inc',
        'weight' => 7
      );

And in og.pages.inc, the function is:

     function og_broadcast_form($form_state, $node) {
       drupal_set_title(t('Send message to %group', array('%group' => $node->title)));
    
       if (!empty($form_state['post'])) {
         drupal_set_message(t('Your message will be sent to all members of this group.'));
       }
    
       $form['subject'] = array(
        '#type' => 'textfield',
        '#title' => t('Subject'),
        '#size' => 70,
        '#maxlength' => 250,
        '#description' => t('Enter a subject for your message.'),
        '#required' => TRUE,
      );
      $form['body'] = array(
        '#type' => 'textarea',
        '#title' => t('Body'),
        '#rows' => 5,
        '#cols' => 90,
        '#description' => t('Enter a body for your message.'),
        '#required' => TRUE
      );
      $form['send'] = array('#type' => 'submit', '#value' => t('Send message'));
      $form['gid'] = array('#type' => 'value', '#value' => $node->nid);
      return $form;
    }

I've tried a number of variations of drupal_get_form:

    print drupal_get_form('og_broadcast_form', NULL, arg(1)); //where arg 1 is the node id from the url
    print drupal_get_form('og_broadcast_form');
    print drupal_get_form('og_broadcast_form', &$form_state, arg(1));
    print drupal_get_form('og_broadcast_form', $n); //where $n is node_load(arg(1));
    print drupal_get_form('og_broadcast_form', &$form_state, $n); 

etc., etc... Is there a way to accomplish what I'm trying to do here?

Comments

socialnicheguru’s picture

have you been able to solve this?

http://SocialNicheGuru.com
Delivering inSITE(TM), we empower you to deliver the right product and the right message to the right NICHE at the right time across all product, marketing, and sales channels.