You are here

function text_widget_settings in Content Construction Kit (CCK) 5

Same name and namespace in other branches
  1. 6.3 modules/text/text.module \text_widget_settings()
  2. 6 examples/simple_field.php \text_widget_settings()
  3. 6 examples/example_field.php \text_widget_settings()
  4. 6 modules/text/text.module \text_widget_settings()
  5. 6.2 modules/text/text.module \text_widget_settings()

Implementation of hook_widget_settings().

File

./text.module, line 265
Defines simple text field types.

Code

function text_widget_settings($op, $widget) {
  switch ($op) {
    case 'form':
      $form = array();
      $form['rows'] = array(
        '#type' => 'textfield',
        '#title' => t('Rows'),
        '#default_value' => $widget['rows'] ? $widget['rows'] : 1,
        '#required' => TRUE,
      );
      return $form;
    case 'validate':
      if (!is_numeric($widget['rows']) || intval($widget['rows']) != $widget['rows'] || $widget['rows'] <= 0) {
        form_set_error('rows', t('"Rows" must be a positive integer.'));
      }
      break;
    case 'save':
      return array(
        'rows',
      );
  }
}