class SubscribeRoutes in SendinBlue 8
Same name and namespace in other branches
- 8.2 src/Routing/SubscribeRoutes.php \Drupal\sendinblue\Routing\SubscribeRoutes
Defines dynamic routes.
Hierarchy
- class \Drupal\sendinblue\Routing\SubscribeRoutes implements ContainerInjectionInterface
Expanded class hierarchy of SubscribeRoutes
1 string reference to 'SubscribeRoutes'
1 service uses SubscribeRoutes
File
- src/
Routing/ SubscribeRoutes.php, line 14
Namespace
Drupal\sendinblue\RoutingView source
class SubscribeRoutes implements ContainerInjectionInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* EntityModerationForm constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('entity_type.manager'));
}
/**
* {@inheritdoc}
*/
public function routes() {
$routes = [];
$signups = $this->entityTypeManager
->getStorage(SendinblueManager::SENDINBLUE_SIGNUP_ENTITY)
->loadMultiple();
foreach ($signups as $signup) {
if ((int) $signup->mode->value == SendinblueManager::SENDINBLUE_SIGNUP_PAGE || (int) $signup->mode->value == SendinblueManager::SENDINBLUE_SIGNUP_BOTH) {
$settings = !$signup->settings
->first() ? [] : $signup->settings
->first()
->getValue();
$routes['sendinblue.subscribe.' . $signup->name->value] = new Route('/' . $settings['path'], [
'_form' => '\\Drupal\\sendinblue\\Form\\SubscribeForm',
'_title' => $signup->title->value,
'mcsId' => $signup->mcsId->value,
], [
'_permission' => 'access content',
]);
}
}
return $routes;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SubscribeRoutes:: |
protected | property | The entity type manager. | |
SubscribeRoutes:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
SubscribeRoutes:: |
public | function | ||
SubscribeRoutes:: |
public | function | EntityModerationForm constructor. |