I am trying to use the drupal_get_form funtion outside of a menu and am not having any luck finding examples of how this is done.
An overview of what I am trying to achieve is: 1) Pass control from a script using an href html tag passing to another script that will then read what has been passed to the new script and build a form based on the action that has been passed in. I am using the drupal_get_form function just as you would any php function. 2) I am also getting a message that says drupal_get_form is an unknown function.
This script is the initial calling script that contains an html href link to the called processing script.
function view_payment_methods() { try {$result = db_select('tls_connect_cashier_payment_methods', 'q') ->fields('q', array('id', 'payment_method', 'payment_desc', 'logically_deleted', 'system_or_user')) ->orderBy('payment_desc') ->execute(); } catch(Exception $e) { watchdog_exception( 'view_payment_methods', $e, 'Select from tls_connect_cashier_payment_methods has failed.', null, 'Alert' ); return false; } $payment_methods = $result->fetchAll(PDO::FETCH_ASSOC); $col1_label = t('Payment Method'); $col2_label = t('Payment Description'); $col3_label = t('Disabled'); $col4_label = t('Created By'); $col5_label = t('Action'); $edit_label = '(' . t('Edit') . ')'; $delete_label = '(' . t('Delete') . ')'; $markup = "<h1>" . t('Payment Methods') . "</h1>"; $markup .= "<table>"; $line = "<tr>"; $line .= "<td>" . $col1_label . "</td>"; $line .= "<td>" . $col2_label . "</td>"; $line .= "<td>" . $col3_label . "</td>"; $line .= "<td>" . $col4_label . "</td>"; $line .= "<td>" . $col5_label . "</td>"; $line .= "</tr>"; $markup .= $line; if (isset($payment_methods[0])) { foreach ($payment_methods as $entry) { $disabled = ''; $created_by = ''; $id = $entry['id']; $payment_method = $entry['payment_method']; $payment_desc = $entry['payment_desc']; $logically_deleted = $entry['logically_deleted']; $system_or_user = $entry['system_or_user']; $line = "<tr>"; $line .= "<td>" . t($payment_method) . "</td>"; $line .= "<td>" . t($payment_desc) . "</td>"; if ($disabled == 0) { $disabled = 'No'; } else { $disabled = 'Yes'; } $line .= "<td>" . t($disabled) . "</td>"; if ($system_or_user == 'S') { $created_by = 'System'; } else { $created_by = 'User'; } $line .= "<td>" . t($created_by) . "</td>"; $line .= "<td><a href = '/TLSConnect3App/sites/all/modules/custom/TLSConnectPackage/cashier/PaymentMethodEditDelete.php?action=edit&id=" . $id . "'>" . $edit_label . "</a> <a href = '/TLSConnect3App/sites/all/modules/custom/TLSConnectPackage/cashier/PaymentMethodEditDelete.php?action=delete&id=" . $id . "'>" . $delete_label . "</a></td>"; $markup .= $line; } } $markup .= "</table>"; return $markup; }
This script is the called script accessed by way of the html href link for the edit link.
if (isset($_GET['action'])) { $id = $_GET['id']; switch ($_GET['action']) { case 'edit': $form_id = 'edit_form'; return drupal_get_form($form_id); break; case 'delete': break; } } function edit_form($form, &$form_state) { global $id; die('chuck'); $form = array(); }