You are here

function insert_form_alter in Insert 8.2

Same name and namespace in other branches
  1. 8 insert.module \insert_form_alter()

Implements hook_form_alter().

File

./insert.module, line 91

Code

function insert_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
  _insert_add_process($form);
  if ($form_id === 'filter_format_edit_form') {
    $text_formats = \Drupal::config('insert.config')
      ->get('text_formats');

    // Ensure attributes set by Insert are not stripped from the output:
    if (in_array($form['format']['#default_value'], $text_formats)) {
      $form['filters']['settings']['filter_html']['allowed_html']['#element_validate'][] = '_insert_allowed_html_validate';
    }
  }
}