You are here

function gin_lb_form_media_library_add_form_alter in Gin Layout Builder 1.0.x

Implements hook_form_BASE_FORM_ID_alter().

File

./gin_lb.module, line 503
Provides hooks for gin_lb module.

Code

function gin_lb_form_media_library_add_form_alter(array &$form, FormStateInterface $form_state) {
  $form['#attributes']['class'][] = 'media-library-add-form';

  // If there are unsaved media items, apply styling classes to various parts
  // of the form.
  if (isset($form['media'])) {
    $form['#attributes']['class'][] = 'media-library-add-form--with-input';

    // Put a wrapper around the informational message above the unsaved media
    // items.
    $form['description']['#template'] = '<p class="glb-media-library-add-form__description">{{ text }}</p>';
  }
  else {
    $form['#attributes']['class'][] = 'media-library-add-form--without-input';
  }
}