How to add external CSS/JS libraries via library API and including these libraries in a field widget? [closed]

My new libraries aren’t loaded when adding them either by drupal_add_library(‘mymodule’, ‘mylibrary’); nor by altering widget’s #attached library property. I’ve also tested that libraries are found and installed but from console I can see that CSS/JS isn’t requested and also scripts/page breaks due to undefined functions etc… I’ve registered these external libraries via hook_libraries_info() by…

Magneto 2 Custom Module – Load Subscriber Email in PHTML file after newsletter subscription

I am working on a custom module where we need to load the email address of a newsletter subscriber in a phtml file after they subscribe. Our Observer file is triggered on a subscription event and collections the following data: public function execute(\Magento\Framework\Event\Observer $observer){ $event = $observer->getEvent(); $subscriber = $event->getSubscriber(); $email = $subscriber->getEmail(); $promoCode =…

How to inject a service into a callback in ajax form?

I can’t access to my injected service from inside a form #ajax callback method : this is the form element that triggers the #ajax callback ( which is an external class method): /src/Form/EndPointConstructorForm.php $form[‘bundle’] = [ ‘#ajax’ => [ ‘event’ => ‘change’, ‘callback’ => ‘\Drupal\jsonapi_endpoint_explorer\AjaxHandler\EndPointConstructorAjaxHandler::bundleOnChange’, ‘wrapper’ => ‘sort-edit’, ], ]; this is the triggered callback…