You are here

function claro_form_media_form_alter in Drupal 9

Same name and namespace in other branches
  1. 8 core/themes/claro/claro.theme \claro_form_media_form_alter()

Implements hook_form_BASE_FORM_ID_alter() for \Drupal\media\MediaForm.

File

core/themes/claro/claro.theme, line 566
Functions to support theming in the Claro theme.

Code

function claro_form_media_form_alter(&$form, FormStateInterface $form_state) {

  // Only attach CSS from core if this form comes from Media core, and not from
  // the contrib Media Entity 1.x branch.
  if (\Drupal::moduleHandler()
    ->moduleExists('media') && $form_state
    ->getFormObject() instanceof MediaForm) {

    // @todo Revisit after https://www.drupal.org/node/2892304 is in. It
    // introduces a footer region to these forms which will allow for us to
    // display a top border over the published checkbox by defining a
    // media-edit-form.html.twig template the same way node does.
    $form['#attached']['library'][] = 'claro/media-form';
  }
}