-3

Situation

  • custom module adding styles
  • don't add styles to node editing form

How to avoid adding the style to the editing forms?

function crossfade_page_attachments(array &$page) {
  $page['#attached']['library'][] = 'crossfade/crossfade';
}

1 Answer 1

0

Currently discovered answer derived from the metatag module)

function crossfade_page_attachments(array &$page) {
  if (\Drupal::service('router.admin_context')->isAdminRoute()) {
    return FALSE;
  }
  $page['#attached']['library'][] = 'crossfade/crossfade';
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.