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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.