class BakeryRoutes in Bakery Single Sign-On System 8.2
Defines dynamic routes.
Hierarchy
- class \Drupal\bakery\Routing\BakeryRoutes implements ContainerInjectionInterface
Expanded class hierarchy of BakeryRoutes
File
- src/
Routing/ BakeryRoutes.php, line 15
Namespace
Drupal\bakery\RoutingView source
class BakeryRoutes implements ContainerInjectionInterface {
/**
* @var \Drupal\Core\Config\ImmutableConfig
*/
protected $config;
public function __construct(ConfigFactoryInterface $config_factory) {
$this->config = $config_factory
->get('bakery.settings');
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('config.factory'));
}
/**
* {@inheritdoc}
*/
public function routes() {
$routes = new RouteCollection();
$subsite_login = $this->config
->get('subsite_login');
if (empty($this->config
->get('bakery_key'))) {
// Without a key nothing works so don't expose any dynamic routes.
}
elseif ($this->config
->get('bakery_is_master')) {
if ($subsite_login) {
$routes
->add('bakery.register', new Route('/bakery', [
'_controller' => '\\Drupal\\bakery\\Controller\\MainDeprecatedController::register',
'_title' => 'Register',
], [
'_custom_access' => '\\Drupal\\bakery\\Controller\\MainDeprecatedController::userIsAnonymous',
]));
$routes
->add('bakery.login', new Route('/bakery/login', [
'_controller' => '\\Drupal\\bakery\\Controller\\MainDeprecatedController::login',
'_title' => 'Login',
], [
'_access' => 'TRUE',
]));
}
$routes
->add('bakery.create', new Route('/bakery/create', [
'_controller' => '\\Drupal\\bakery\\Controller\\MainController::eatGingerbreadCookie',
'_title' => 'Bakery create',
], [
'_custom_access' => '\\Drupal\\bakery\\Controller\\MainController::tasteGingerbreadCookie',
]));
}
else {
if ($subsite_login) {
$routes
->add('bakery.register', new Route('/bakery', [
'_controller' => '\\Drupal\\bakery\\Controller\\ChildDeprecatedController::registerReturn',
'_title' => 'Register',
], [
'_access' => 'TRUE',
]));
$routes
->add('bakery.create', new Route('/bakery/login', [
'_controller' => '\\Drupal\\bakery\\Controller\\ChildDeprecatedController::loginReturn',
'_title' => 'Login',
], [
'_access' => 'TRUE',
]));
}
$routes
->add('bakery.update', new Route('/bakery/update', [
'_controller' => '\\Drupal\\bakery\\Controller\\ChildController::eatStroopwafelCookie',
'_title' => 'Update',
], [
'_custom_access' => '\\Drupal\\bakery\\Controller\\ChildController::tasteStroopwafelCookie',
]));
$routes
->add('bakery.repair', new Route('/bakery/repair', [
'_form' => '\\Drupal\\bakery\\Forms\\BakeryUncrumbleForm',
'_title' => 'Repair account',
], [
'_custom_access' => '\\Drupal\\bakery\\Forms\\BakeryUncrumbleForm::uncrumbleAccess',
]));
$routes
->add('bakery.pull', new Route('/admin/config/people/bakery', [
'_form' => '\\Drupal\\bakery\\Forms\\BakeryPullForm',
'_title' => 'Pull Bakery user',
], [
'_permission' => 'administer users',
]));
}
$routes
->addOptions([
'compiler_class' => RouteCompiler::class,
]);
return $routes;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BakeryRoutes:: |
protected | property | ||
BakeryRoutes:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
BakeryRoutes:: |
public | function | ||
BakeryRoutes:: |
public | function |