You are here

function email_widget_settings in Email Field 5

Same name and namespace in other branches
  1. 6.2 email.module \email_widget_settings()
  2. 6 email.module \email_widget_settings()

Implementation of hook_widget_settings().

File

./email.module, line 104

Code

function email_widget_settings($op, $widget) {
  switch ($op) {
    case 'form':
      $form = array();
      $form['size'] = array(
        '#type' => 'textfield',
        '#title' => t('Size'),
        '#default_value' => isset($widget['size']) ? $widget['size'] : 60,
        '#required' => FALSE,
        '#description' => t('Size of textfield'),
      );
      return $form;
    case 'validate':
      if (!empty($widget['size']) && (!is_numeric($widget['size']) || intval($widget['size']) != $widget['size'] || $widget['size'] <= 0)) {
        form_set_error('size', t('"Size" must be a positive integer.'));
      }
      break;
    case 'save':
      return array(
        'size',
      );
  }
}