awareness
Provides traits and improve DX for commonly-used services.
See the code to see which services are supported.
Example: Add the entity type manager to a service
namespace Drupal\my_module;
use Drupal\awareness\Entity\EntityTypeManagerAwareTrait
/**
* My service.
*/
class MyService {
use EntityTypeManagerAwareTrait;
// Custom code can call $this->getEntityTypeManager() to utilize the service.
}
Creating awareness for custom services
This module provides a Drush code generator to create awareness traits. If your module provides service, run the following to create traits for your services:
drush gen awareness:trait
Creating awareness for core services
A good bit of the commonly-used core services are provided by the traits included in this module. If you come across a core service that is not supported, please open an issue and/or a merge request to add a trait for the service.
Creating awareness for contrib services
This module is not intending to provide awareness for services from other contrib modules--that's their job. If there is a very widely used module that won't provide awareness of its services, we can discuss adding a submodule to this project to provide awareness.