You are here

function brazilianids_widget_settings in Brazilian IDs 6

Implementation of hook_widget_settings().

File

./brazilianids_cck.inc, line 206
brazilianids_cck.inc Deal with brazilian IDs like CPF and CNPJ as CCK fields.

Code

function brazilianids_widget_settings($op, $widget) {
  switch ($op) {

    // Create the form element to be used on the widget
    // settings form. Widget settings can be different
    // for each shared instance of the same field and
    // should define the way the value is displayed to
    // the user in the edit form for that content type.
    case 'form':
      $form = array();
      $size = isset($widget['size']) && is_numeric($widget['size']) ? $widget['size'] : 18;
      $form['size'] = array(
        '#type' => 'textfield',
        '#title' => t('Size of textfield'),
        '#default_value' => $size,
        '#element_validate' => array(
          '_element_validate_integer_positive',
        ),
        '#required' => TRUE,
      );
      return $form;

    // Return an array of the names of the widget settings
    // defined by this module. These are the items that
    // CCK will store in the widget definition and they
    // will be available in the $field['widget'] array.
    // This should match the items defined in 'form' above.
    case 'save':
      return array(
        'size',
      );
  }
}