function UmamiHooks::formAlter

Same name and namespace in other branches
  1. 11.x core/profiles/demo_umami/themes/umami/src/Hook/UmamiHooks.php \Drupal\umami\Hook\UmamiHooks::formAlter()

Implements hook_form_alter().

@todo revisit in https://drupal.org/node/3110132

Attributes

#[Hook('form_alter')]

File

core/profiles/demo_umami/themes/umami/src/Hook/UmamiHooks.php, line 167

Class

UmamiHooks
Hook implementations for umami.

Namespace

Drupal\umami\Hook

Code

public function formAlter(array &$form, FormStateInterface $form_state, $form_id) : void {
  $form_object = $form_state->getFormObject();
  if ($form_object instanceof ViewsForm && str_starts_with($form_object->getBaseFormId(), 'views_form_media_library')) {
    $form['#attributes']['class'][] = 'media-library-views-form';
  }
}

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