function seven_form_media_library_add_form_alter
Same name in other branches
- 8.9.x core/themes/seven/seven.theme \seven_form_media_library_add_form_alter()
Implements hook_form_BASE_FORM_ID_alter().
File
-
core/
themes/ seven/ seven.theme, line 238
Code
function seven_form_media_library_add_form_alter(array &$form, FormStateInterface $form_state) {
$form['#attributes']['class'][] = 'media-library-add-form';
$form['#attached']['library'][] = 'seven/media_library';
// 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="media-library-add-form__description">{{ text }}</p>';
}
else {
$form['#attributes']['class'][] = 'media-library-add-form--without-input';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.