You are here

function _webform_edit_email in Webform 5

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

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/email.inc, line 11

Code

function _webform_edit_email($currfield) {
  $edit_fields = array();
  $edit_fields['extra']['width'] = array(
    '#type' => 'textfield',
    '#title' => t("Width"),
    '#default_value' => $currfield['extra']['width'],
    '#description' => t('Width of the textfield.'),
    '#size' => 5,
    '#maxlength' => 10,
  );
  $edit_fields['value'] = array(
    '#type' => 'checkbox',
    '#title' => t("User email as default"),
    '#default_value' => $currfield['default'],
    '#return_value' => 'user email',
    '#description' => t('Set the default value of this field to the user email, if he/she is logged in.'),
  );
  $edit_fields['extra']['carboncopy'] = array(
    '#type' => 'checkbox',
    '#title' => t("CC submission to this email"),
    '#return_value' => 'Y',
    '#default_value' => $currfield['extra']['carboncopy'] == 'Y' ? TRUE : FALSE,
    '#description' => t('Check this option if the email specified in this component should get a CC submission.') . ' ' . t('Note that this opens the risk that the form can be used to send emails to any address and might be missused as a spam gateway.'),
  );
  $edit_fields['extra']['attributes']['disabled'] = array(
    '#type' => 'checkbox',
    '#title' => t("Disabled"),
    '#return_value' => 'disabled',
    '#description' => t('Make this field non-editable. Useful for setting an unchangeable default value.'),
    '#weight' => 3,
    '#default_value' => $currfield['extra']['attributes']['disabled'],
  );
  return $edit_fields;
}