You are here

function cckformsettings_form_alter in Node and Comments Form Settings 6.3

Same name and namespace in other branches
  1. 6 cckformsettings.module \cckformsettings_form_alter()
  2. 6.2 cckformsettings/cckformsettings.module \cckformsettings_form_alter()

Implementation of hook_form_alter()

File

cckformsettings/cckformsettings.module, line 8

Code

function cckformsettings_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'content_field_edit_form') {
    if ($form['#field']['type'] == 'text' && $form['#field']['widget']['type'] == 'text_textarea') {
      cckformsettings_admin_form($form);
      $form['field']['text_processing']['#weight'] = 1;
      $form['field']['text_processing']['#prefix'] = '<div class="cckformsettings-radios">';
      $form['field']['text_processing']['#suffix'] = '</div>';
      $form['field']['max_length']['#weight'] = 3;
      $form['field']['allowed_values_fieldset']['#weight'] = 4;
      drupal_add_js(drupal_get_path('module', 'cckformsettings') . '/cckformsettings.js');
      $text_processing = $form['field']['text_processing']['#default_value'];
      if ($text_processing = 1) {
        $css_class .= 'cckformsettings-show';
      }
      else {
        $css_class = 'js-hide';
      }
      $form['field']['cckformsettings_inputformat']['#prefix'] = '<div class="' . $css_class . '">';
      $form['field']['cckformsettings_inputformat']['#suffix'] = '</div>';
    }
  }
}