public function SubscribeRoutes::routes in SendinBlue 8
Same name and namespace in other branches
- 8.2 src/Routing/SubscribeRoutes.php \Drupal\sendinblue\Routing\SubscribeRoutes::routes()
1 string reference to 'SubscribeRoutes::routes'
File
- src/
Routing/ SubscribeRoutes.php, line 44
Class
- SubscribeRoutes
- Defines dynamic routes.
Namespace
Drupal\sendinblue\RoutingCode
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;
}