You are here

function eloqua_form_webform_component_edit_form_alter in Eloqua 6

Implementatation of hook_form_FORM_ID_alter(). This function is reponsible for adding the form-id mapping values to the Component add/edit page Note: this isn't used for the fieldset type.

File

./eloqua.module, line 97

Code

function eloqua_form_webform_component_edit_form_alter(&$form, $form_state) {
  $component = array_key_exists(3, $form['#parameters']) ? $form['#parameters'][3] : NULL;
  if ($component === NULL) {
    return;
  }

  // Create the fieldset
  $form['eloqua'] = array(
    '#type' => 'fieldset',
    '#title' => t('Eloqua'),
    '#tree' => TRUE,
  );

  // Check the field type.  Some do not make sense as having a value to post to Eloqua
  if (!_eloqua_is_valid_component_type($component['type'])) {
    $form['eloqua']['msg'] = array(
      '#type' => 'markup',
      '#value' => t('This component type is not compatible with the Eloqua Module.'),
    );
    return;
  }
  $form['eloqua']['key'] = array(
    '#type' => 'textfield',
    '#default_value' => isset($component['extra']['eloqua']['key']) ? $component['extra']['eloqua']['key'] : '',
    '#title' => t('Eloqua Field Name'),
    '#description' => t('The eloqua field name if it contains symbols or characters not compatible with the defaults above. Leave empty to use the default above. Can not contain spaces.'),
    '#weight' => 0,
  );
  $form['eloqua']['query_name'] = array(
    '#type' => 'textfield',
    '#default_value' => isset($component['extra']['eloqua']['query_name']) ? $component['extra']['eloqua']['query_name'] : '',
    '#description' => t('If this value can be populated by a query parameter, the key that is to be used. Can only contain the characters a-z A-Z 0-9 and _.'),
    '#title' => t('Request Parameter Key'),
  );
  $form[]['#validate'] = 'eloqua_form_webform_component_edit_form_validate';
}