function MediaLibraryHooks::viewsFormAfterBuild

Form #after_build callback for media_library view's exposed filters form.

@internal

File

core/modules/media_library/src/Hook/MediaLibraryHooks.php, line 271

Class

MediaLibraryHooks
Hook implementations for media_library.

Namespace

Drupal\media_library\Hook

Code

public function viewsFormAfterBuild(array $form, FormStateInterface $form_state) : array {
  // Remove .form-actions from the view's exposed filter actions. This
  // prevents the "Apply filters" submit button from being moved into the
  // dialog's button area.
  // @see \Drupal\Core\Render\Element\Actions::processActions
  // @see Drupal.behaviors.dialog.prepareDialogButtons
  // @todo Remove this after
  //   https://www.drupal.org/project/drupal/issues/3089751 is fixed.
  if (($key = array_search('form-actions', $form['actions']['#attributes']['class'])) !== FALSE) {
    unset($form['actions']['#attributes']['class'][$key]);
  }
  return $form;
}

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