function media_library_theme_reset_form_media_library_add_form_alter in Media Library Theme Reset 8
Implements hook_form_BASE_FORM_ID_alter().
File
- ./
media_library_theme_reset.module, line 145 - Contains media_library_theme_reset.module.
Code
function media_library_theme_reset_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="media-library-add-form__description">{{ text }}</p>';
}
else {
$form['#attributes']['class'][] = 'media-library-add-form--without-input';
}
}