You are here

function _webform_edit_mapping in Webform Bonus Pack 6.3

Same name and namespace in other branches
  1. 7.3 components/mapping.inc \_webform_edit_mapping()

Implementation of _webform_edit_component().

File

components/mapping.inc, line 39
Webform module mapping component.

Code

function _webform_edit_mapping($component) {
  $form = array();
  $form['value'] = array(
    '#type' => 'textfield',
    '#title' => t('Default value'),
    '#default_value' => $component['value'],
    '#description' => t('The default value of the field.') . theme('webform_token_help'),
    '#weight' => 0,
  );
  $node = node_load($component['nid']);
  $options = array();
  foreach ($node->webform['components'] as $id => $c) {
    $options[$id] = $c['name'];
  }
  unset($options[$component['cid']]);
  $form['extra']['mapped_component'] = array(
    '#type' => 'select',
    '#title' => t('Select Mapped component'),
    '#default_value' => $component['extra']['mapped_component'],
    '#options' => $options,
    '#description' => t('Select component to which current component should be mapped'),
  );
  $form['extra']['items'] = array(
    '#type' => 'textarea',
    '#title' => t('Mapping options'),
    '#default_value' => $component['extra']['items'],
    '#description' => t('<strong>Key-value pairs MUST be specified as "value of mapped component|return value"</strong>. One pair per line.') . theme('webform_token_help'),
    '#cols' => 60,
    '#rows' => 5,
    '#required' => TRUE,
    '#wysiwyg' => FALSE,
    '#element_validate' => array(
      '_webform_edit_validate_mapping',
    ),
  );
  $form['extra']['description'] = array();

  // Hide the description box.
  $form['display'] = array(
    '#type' => 'markup',
  );

  // Hide the display options.
  $form['display']['title_display'] = array();
  return $form;
}