function MediaHooks::formFilterFormatAddFormAlter

Implements hook_form_FORM_ID_alter().

Attributes

#[Hook('form_filter_format_add_form_alter')]

File

core/modules/media/src/Hook/MediaHooks.php, line 235

Class

MediaHooks
Hook implementations for media.

Namespace

Drupal\media\Hook

Code

public function formFilterFormatAddFormAlter(array &$form, FormStateInterface $form_state, $form_id) : void {
  // Add an additional validate callback so we can ensure the order of filters
  // is correct, this is not necessary when using ckeditor5 since allowed tags
  // are added automatically by CKEditor 5. The validator would conflict with
  // the automatic addition of those allowed tags.
  if ($form_state->getValue('editor') !== 'ckeditor5') {
    $form['#validate'][] = 'media_filter_format_edit_form_validate';
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.