You are here

function cck_table_field_widget_settings_form in CCK Table Field 7

Same name and namespace in other branches
  1. 8 cck_table.module \cck_table_field_widget_settings_form()

Implements of hook_field_widget_settings_form().

File

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

Code

function cck_table_field_widget_settings_form($field, $instance) {
  $form = array();
  $form['rows'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of Rows'),
    '#default_value' => isset($instance['widget']['settings']['rows']) ? $instance['widget']['settings']['rows'] : CCK_TABLE_DEFAULT_ROWS,
    '#required' => TRUE,
    '#element_validate' => array(
      '_element_validate_integer_positive',
    ),
  );
  $form['separator'] = array(
    '#type' => 'textfield',
    '#title' => t('Separator'),
    '#description' => t('Separator to use to distinguish cells in a row'),
    '#default_value' => isset($instance['widget']['settings']['separator']) ? $instance['widget']['settings']['separator'] : CCK_TABLE_DEFAULT_SEPARATOR,
    '#size' => 5,
    '#required' => TRUE,
  );
  $form['enforce_misalign_col'] = array(
    '#type' => 'checkbox',
    '#title' => 'Enforce Mis-Align Column',
    '#default_value' => isset($instance['widget']['settings']['enforce_misalign_col']) ? $instance['widget']['settings']['enforce_misalign_col'] : CCK_TABLE_ENFORCE_MISALIGN_COL,
    '#description' => 'If Enabled, each row must have the same number of columns or an error will be thrown.',
  );
  $form['css_id'] = array(
    '#type' => 'textfield',
    '#title' => t('CSS ID'),
    '#description' => t('Specify an ID to be assigned to the table element.') . '<br />' . t('The node ID will be appended to keep the ID unique.'),
    '#default_value' => isset($instance['widget']['settings']['css_id']) ? $instance['widget']['settings']['css_id'] : '',
    '#field_suffix' => '-##',
  );
  $form['css_class'] = array(
    '#type' => 'textfield',
    '#title' => t('CSS Class'),
    '#description' => t('Specify a class to be added to the table element.'),
    '#default_value' => isset($instance['widget']['settings']['css_class']) ? $instance['widget']['settings']['css_class'] : '',
  );
  return $form;
}