You are here

function tablefield_field_settings in TableField 6

Implementation of hook_field_settings().

File

./tablefield.module, line 48
This module provides a set of fields that can be used to store tabular data with a node. The implementation uses a custom CCK widget.

Code

function tablefield_field_settings($op, $field) {
  switch ($op) {
    case 'form':
      $form = array();
      $options = array(
        0 => t('Plain text'),
        1 => t('Filtered text (user selects input format)'),
      );
      $form['cell_processing'] = array(
        '#type' => 'radios',
        '#title' => t('Table cell processing'),
        '#default_value' => is_numeric($field['cell_processing']) ? $field['cell_processing'] : 0,
        '#options' => $options,
      );
      $form['default_message'] = array(
        '#type' => 'markup',
        '#value' => t('To specify a default table, use the "Default Value" above. There you can specify a default number of rows/columns and values.'),
      );
      return $form;
    case 'save':
      $values = array(
        'cell_processing',
        'count_cols',
        'count_rows',
      );
      return $values;
    case 'database columns':
      $columns = array();

      // Input format
      if (!empty($field['cell_processing'])) {
        $columns['format'] = array(
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => FALSE,
          'views' => FALSE,
        );
      }
      $columns['value'] = array(
        'type' => 'text',
      );
      return $columns;
    case 'views data':
      $data = content_views_field_views_data($field);
      return $data;
  }
}