You are here

function geshifield_widget_settings in GeSHi Filter for syntax highlighting 6

Implementation of hook_widget_settings().

File

geshifield/geshifield.module, line 182
Defines a CCK field for source code with GeSHi syntax highlighting.

Code

function geshifield_widget_settings($op, $widget) {
  switch ($op) {
    case 'form':
      $form = array();
      $form['rows'] = array(
        '#type' => 'textfield',
        '#title' => t('Default number of rows in text area'),
        '#description' => t('The default number of rows to provide in the text area for entering the source code.'),
        '#default_value' => isset($widget['rows']) ? $widget['rows'] : 20,
        '#required' => TRUE,
      );

      // @todo add an option for the default language
      return $form;
      break;
    case 'validate':
      if (!is_numeric($widget['rows']) || intval($widget['rows']) != $widget['rows'] || $widget['rows'] <= 0 || $widget['rows'] > 100) {
        form_set_error('rows', t('The number of rows must be an integer between 1 and 100.'));
      }
      break;
    case 'save':
      return array(
        'rows',
      );
      break;
  }
}