0

I have a UserLogin event subscriber. I want this subscriber to output a variable from marketing tracking purposes to Javascript, however, I don't see how I could accomplish this, as the Event Subscriber is a class that only implements an interface, but it doesn't have access to Drupal hooks, like:

function lotus_preprocess_html(&$variables) {
  $lotus_height = '300px';
  //Add a JS library
  $variables['#attached']['library'][] = 'lotus/lotus-js';
  $variables['#attached']['drupalSettings']['lotus']['lotusJS']['lotus_height'] = $lotus_height;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.