We are just trying to gain a deeper understanding of Drupal forms and how to manipulate and render them as needed.

We have a module installed which allows uses to edit and create content through a form.  The module renders the form on its own edit/create page.  We would like to render the edit/create forms on a different page with other content.

Below are a few functions which we believe render the forms. (if not which function should we be looking for??)

    /**
     * Page callback for creating a customer profile of a given type.
     */
    function commerce_addressbook_profile_create($account, $profile_type) {
      // Add the breadcrumb for the form's location.
      commerce_addressbook_set_breadcrumb($account, $profile_type);
    
      $profile = commerce_customer_profile_new($profile_type, $account->uid);
      // The submit handler needs an indication that the profile was just added.
      // The regular is_new property gets unset after save is complete.
      $profile->_is_new = TRUE;
      module_load_include('inc', 'commerce_customer', 'includes/commerce_customer_profile.forms');
      return drupal_get_form('commerce_addressbook_customer_profile_form', $profile);
    }
    
    /**
     * Page callback for editing a customer profile.
     */
    function commerce_addressbook_profile_options_edit($account, $customer_profile) {
      // Add the breadcrumb for the form's location.
      commerce_addressbook_set_breadcrumb($account, $customer_profile->type);
    
      // If the profile is referenced by an order, make sure it gets duplicated.
      $profile = clone($customer_profile);
      if (!commerce_customer_profile_can_delete($customer_profile)) {
        $profile->previous_id = $profile->profile_id;
        unset($profile->profile_id);
        unset($profile->revision_id);
        $profile->is_new = TRUE;
      }
      module_load_include('inc', 'commerce_customer', 'includes/commerce_customer_profile.forms');
      return drupal_get_form('commerce_addressbook_customer_profile_form', $profile);
    }

What is the process for calling these functions (if they are the ones we are looking for) into a TPL page?


----------


----------


----------


**EASY TO READ COMMENTS:**
I have added the follow to template.php within my theme directory

    function THEME_preprocess_page(&$variables){
        module_load_include('inc', 'commerce_addressbook', 'includes/commerce_addressbook.user');
        $variables['profile_form'] = commerce_addressbook_profile_options_edit($account, $customer_profile);
    }

I have also included the following with a page tpl file.

    <?php print render($profile_form); ?>

This results in the page returning a 500 error. (commenting out the variables line allows the page to load.)