public function SiteAlertBlock::__construct in Site Alert 8
Constructs a new SiteAlertBlock.
Parameters
array $configuration: A configuration array containing information about the plugin instance.
string $plugin_id: The plugin_id for the plugin instance.
mixed $plugin_definition: The plugin implementation definition.
\Drupal\site_alert\GetAlertsInterface $getAlerts: The service that retrieves site alerts.
\Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager: The entity type manager service.
\Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler: The module handler.
Overrides BlockPluginTrait::__construct
File
- src/
Plugin/ Block/ SiteAlertBlock.php, line 68
Class
- SiteAlertBlock
- Implements SiteAlertBlock class.
Namespace
Drupal\site_alert\Plugin\BlockCode
public function __construct(array $configuration, $plugin_id, $plugin_definition, GetAlertsInterface $getAlerts, EntityTypeManagerInterface $entityTypeManager, ModuleHandlerInterface $moduleHandler) {
if (empty($entity_type_manager)) {
@trigger_error('Omitting the entity type manager when instantiating ' . __METHOD__ . ' is deprecated in site_alert:8.x-1.1 and will throw an error in site_alert:9.x-1.0. Make sure to pass the entity type manager instead. See https://www.drupal.org/project/site_alert/issues/3118227', E_USER_DEPRECATED);
$entityTypeManager = \Drupal::entityTypeManager();
}
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->getAlerts = $getAlerts;
$this->entityTypeManager = $entityTypeManager;
$this->moduleHandler = $moduleHandler;
}