You are here

function media_library_form_alter in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media_library/media_library.module \media_library_form_alter()

Implements hook_form_alter().

File

core/modules/media_library/media_library.module, line 295
Contains hook implementations for the media_library module.

Code

function media_library_form_alter(array &$form, FormStateInterface $form_state, $form_id) {

  // Add a process callback to ensure that the media library view's exposed
  // filters submit button is not moved to the modal dialog's button area.
  if ($form_id === 'views_exposed_form' && strpos($form['#id'], 'views-exposed-form-media-library-widget') === 0) {
    $form['#after_build'][] = '_media_library_views_form_media_library_after_build';
  }

  // Configures media_library displays when a type is submitted.
  if ($form_state
    ->getFormObject() instanceof MediaTypeForm) {
    $form['actions']['submit']['#submit'][] = '_media_library_media_type_form_submit';
  }
}