You are here

function _webform_edit_hidden in Webform 5.2

Same name and namespace in other branches
  1. 5 components/hidden.inc \_webform_edit_hidden()
  2. 6.3 components/hidden.inc \_webform_edit_hidden()
  3. 6.2 components/hidden.inc \_webform_edit_hidden()
  4. 7.4 components/hidden.inc \_webform_edit_hidden()
  5. 7.3 components/hidden.inc \_webform_edit_hidden()

Create a set of form items to be displayed on the form for editing this component. Use care naming the form items, as this correlates directly to the database schema. The component "Name" and "Description" fields are added to every component type and are not necessary to specify here (although they may be overridden if desired).

Return value

An array of form items to be displayed on the edit component page.

File

components/hidden.inc, line 33
Webform module hidden component.

Code

function _webform_edit_hidden($currfield) {
  $edit_fields = array();
  $edit_fields['value'] = array(
    '#type' => 'textarea',
    '#title' => t('Default value'),
    '#default_value' => $currfield['value'],
    '#description' => t('The default value of the field.') . theme('webform_token_help'),
    '#cols' => 60,
    '#rows' => 5,
    '#weight' => 0,
  );
  $edit_fields['advanced']['mandatory'] = array(
    '#type' => 'hidden',
    '#value' => 1,
  );
  $edit_fields['extra']['email'] = array(
    '#type' => 'checkbox',
    '#title' => t('E-mail a submission copy'),
    '#return_value' => 1,
    '#default_value' => $currfield['extra']['email'],
    '#description' => t('Check this option if this component contains an e-mail address that should get a copy of the submission. Emails are sent individually so other emails will not be shown to the recipient.'),
  );
  $edit_fields['extra']['description'] = array();

  // Hide the description box.
  return $edit_fields;
}