You are here

function wysiwyg_form_alter in Wysiwyg 5.2

Same name and namespace in other branches
  1. 5 wysiwyg.module \wysiwyg_form_alter()
  2. 6.2 wysiwyg.module \wysiwyg_form_alter()
  3. 6 wysiwyg.module \wysiwyg_form_alter()

Implementation of hook_form_alter().

Before Drupal 7, there is no way to easily identify form fields that are input format enabled. As a workaround, we assign a form #after_build processing callback that is executed on all forms after they have been completely built, so form elements are in their effective order and position already.

See also

wysiwyg_process_form()

File

./wysiwyg.module, line 81
Integrate client-side editors with Drupal.

Code

function wysiwyg_form_alter($form_id, &$form) {
  $form['#after_build'][] = 'wysiwyg_process_form';

  // Blog module in Drupal 5 uses a wrong/unusual form element key for the input
  // format selector.
  if ($form_id == 'blog_node_form' && module_exists('blog')) {
    $form['body_filter']['format'] = $form['body_filter']['filter'];
    unset($form['body_filter']['filter']);
  }
}