You are here

function _maxlength_content_form_alter in Maxlength 5.2

Same name and namespace in other branches
  1. 6.2 maxlength.inc \_maxlength_content_form_alter()
  2. 7 maxlength.inc \_maxlength_content_form_alter()
  3. 7.2 maxlength.inc \_maxlength_content_form_alter()
1 call to _maxlength_content_form_alter()
maxlength_form_alter in ./maxlength.module
Implementation of hook_form_alter().

File

./maxlength.module, line 86

Code

function _maxlength_content_form_alter($form_id, &$form) {
  $type = $form['type']['#value'];

  //update the title as needed
  _maxlength_format_element($form['title'], 'title', 'title', $type);

  //update the body as needed
  _maxlength_format_element($form['body_filter']['body'], 'body', 'body', $type);

  //get a list of all the CCK fields for this content type
  if (module_exists('content')) {
    $list = array_keys(content_fields(NULL, $type));

    //update CCK fields as needed
    foreach ($list as $field) {
      if (is_array($form[$field])) {
        foreach ($form[$field] as $key => $input) {
          if (is_array($input['value'])) {
            _maxlength_format_element($form[$field][$key]['value'], $field, str_replace('_', '-', $field) . '-' . $key . '-value');
          }
        }
      }
    }
  }
}