You are here

function cck_table_widget_settings in CCK Table Field 6

Same name and namespace in other branches
  1. 5 cck_table.module \cck_table_widget_settings()

Implementation of hook_widget_settings().

File

./cck_table.module, line 189
Defines a field type that outputs data in a table.

Code

function cck_table_widget_settings($op, $widget) {
  switch ($op) {
    case 'form':
      $form = array();
      $rows = isset($widget['rows']) && is_numeric($widget['rows']) ? $widget['rows'] : CCK_TABLE_DEFAULT_ROWS;
      $misalign_col = isset($widget['enforce_misalign_col']) ? $widget['enforce_misalign_col'] : CCK_TABLE_ENFORCE_MISALIGN_COL;
      $form['rows'] = array(
        '#type' => 'textfield',
        '#title' => t('Rows'),
        '#default_value' => $rows,
        '#element_validate' => array(
          '_element_validate_integer_positive',
        ),
        '#required' => TRUE,
      );
      $form['enforce_misalign_col'] = array(
        '#type' => 'checkbox',
        '#title' => 'Enforce Mis-Align Column',
        '#default_value' => $misalign_col,
        '#description' => 'If Enabled, each row must have the same number of columns or an error will be thrown.',
      );
      return $form;
    case 'save':
      return array(
        'rows',
        'enforce_misalign_col',
      );
  }
}