summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2018-07-22 11:50:04 (GMT)
committerAlex Pott2018-07-22 11:50:11 (GMT)
commite0ea889653b4c25ab976fde481ac683161416f78 (patch)
tree966879dc2c45562ad20f6a8d2f06c6d3cdc8a688
parentf58cfcbb6d811ba9724874b8868b3b885201afb3 (diff)
Issue #2916741 by woprrr, marcoscano, seanB, larowlan, xjm: Don't try to include Media CSS library if Media Entity 1.x is being used
(cherry picked from commit 376421801875b5fb6ee07f1556a32cb7199d742c)
-rw-r--r--core/themes/seven/seven.theme15
1 files changed, 10 insertions, 5 deletions
diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme
index 2ad947c..479a4e3 100644
--- a/core/themes/seven/seven.theme
+++ b/core/themes/seven/seven.theme
@@ -6,6 +6,7 @@
*/
use Drupal\Core\Form\FormStateInterface;
+use Drupal\media\MediaForm;
/**
* Implements hook_preprocess_HOOK() for HTML document templates.
@@ -167,9 +168,13 @@ function seven_form_node_form_alter(&$form, FormStateInterface $form_state) {
* Implements hook_form_BASE_FORM_ID_alter() for \Drupal\media\MediaForm.
*/
function seven_form_media_form_alter(&$form, FormStateInterface $form_state) {
- // @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'][] = 'seven/media-form';
+ // 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'][] = 'seven/media-form';
+ }
}