function ClaroHooks::formMediaFormAlter

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

Attributes

#[Hook('form_media_form_alter')]

File

core/themes/claro/src/Hook/ClaroHooks.php, line 523

Class

ClaroHooks
Hook implementations for claro.

Namespace

Drupal\claro\Hook

Code

public function formMediaFormAlter(&$form, FormStateInterface $form_state) : void {
  // 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';
  }
}

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