If you look at AuthenticationSubscriber::_construct(), you will see how it gets the current user object. More in-depth documentation can be found at Here are some topics to help you get started developing with Drupal. class: Drupal\Core\EventSubscriber\AuthenticationSubscriber Drupal 8.9 Drupal 9.5 Welcome to the Drupal API Documentation This site is an API reference for Drupal, generated from comments embedded in the source code. I did account \Drupal::currentUser () in the definition of getSubscribedEvents () (a static method) inside a class file. Instead of using \Drupal::currentUser(), you define as one of the arguments of your service, which is what the authentication_subscriber service does. I need to get the global user object in Drupal 8. The Drupal-Brightcove Connector allows you to manage Brightcove Video Cloud videos and. There may be changes in internal APIs and experimental modules that require updates to contributed and custom modules. In other words: Drupal 9 is not going to be a totally new CMS that only accidentally carries the same name, like it was the case with Drupal 8 when compared to Drupal 7. This minor release provides new improvements and functionality without breaking backward compatibility (BC) for public APIs. Learn more about Drupal 8 and the Drupal 8 release cycle. That static method is supposed to return a static array describing the events to which the module wants to subscribe the methods used to subscribe to the events will eventually take a different action basing on the user currently logged-in, and the user permissions that user account has.Įvent subscribers are services, and as such they get their dependency injected. Drupal 8-Brightcove Connector: Embedding Content. Overview of Workflows and Content Moderation for Drupal 8, 9, and 10 Last updated MaSite Administration 9.5.x/10.0.x The Workflows and Content Moderation modules allow an editorial team to put any type of content administered in Drupal through a customized editorial workflow and moderation process. This is a minor version (feature release) of Drupal 8 and is ready for use on production sites. In this case, you don't access \Drupal::currentUser() (and any static method returning a service that \Drupal exposes) in that method since it would be getting called too early, when Drupal has not yet initialized the dependency container. If you come across an issue in Drupal core or in a contributed module that you think is a potential security risk for other users, there is a slightly. Since you are using a getSubscribedEvents() static method, I get you are implementing an event subscriber.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |