You are here

function pardot_webform_components_form in Pardot Integration 6

Same name and namespace in other branches
  1. 7.2 pardot_webform/pardot_webform.admin.inc \pardot_webform_components_form()
  2. 7 pardot.admin.inc \pardot_webform_components_form()
1 string reference to 'pardot_webform_components_form'
pardot_menu in ./pardot.module
Implementation of hook_menu().

File

./pardot.admin.inc, line 25

Code

function pardot_webform_components_form($form_state, $node) {
  $form = array();
  $form['#node'] = $node;
  $record = pardot_webform_load($node->nid);
  $form['#record'] = $record;
  $form['details'] = array(
    '#type' => 'fieldset',
    '#title' => t('General'),
  );
  $form['details']['is_active'] = array(
    '#title' => 'Is active',
    '#type' => 'checkbox',
    '#default_value' => $record->is_active,
  );
  $form['details']['url'] = array(
    '#title' => 'Post url',
    '#type' => 'textfield',
    '#default_value' => $record->url,
    '#description' => t('Visit your form handler page in pardot and select "View form handler code", copy the url out of the example code and then paste it here. <br />!example', array(
      '!example' => theme('image', drupal_get_path('module', 'pardot') . '/form-handler-url.jpg'),
    )),
  );
  $form['components'] = array(
    '#tree' => TRUE,
  );
  foreach ($node->webform['components'] as $k => $component) {
    $form['components'][$k] = array(
      '#component' => $component,
      'key' => array(
        '#title' => 'Field name',
        '#type' => 'textfield',
        '#size' => 25,
        '#default_value' => isset($record->data[$component['form_key']]['key']) ? $record->data[$component['form_key']]['key'] : '',
      ),
    );
  }
  $form['save'] = array(
    '#value' => t('Save'),
    '#type' => 'submit',
  );

  //  $form['delete'] = array(
  //    '#value' => t('Delete'),
  //    '#type' => 'submit',
  //  );
  return $form;
}