class ChecklistapiRoutes in Checklist API 8
Provides routes for checklists.
Hierarchy
- class \Drupal\checklistapi\Routing\ChecklistapiRoutes
Expanded class hierarchy of ChecklistapiRoutes
File
- src/
Routing/ ChecklistapiRoutes.php, line 10
Namespace
Drupal\checklistapi\RoutingView source
class ChecklistapiRoutes {
/**
* Provides dynamic routes.
*
* @return \Symfony\Component\Routing\Route[]
* An array of route objects.
*/
public function routes() {
$routes = [];
$definitions = \Drupal::moduleHandler()
->invokeAll('checklistapi_checklist_info');
foreach ($definitions as $id => $definition) {
// Ignore incomplete definitions.
if (empty($definition['#path']) || empty($definition['#title'])) {
continue;
}
$requirements = [
'_checklistapi_access' => 'TRUE',
];
// View/edit checklist.
$routes["checklistapi.checklists.{$id}"] = new Route($definition['#path'], [
'_title' => (string) $definition['#title'],
'_form' => '\\Drupal\\checklistapi\\Form\\ChecklistapiChecklistForm',
'checklist_id' => $id,
'op' => 'any',
], $requirements);
// Clear saved progress.
$routes["checklistapi.checklists.{$id}.clear"] = new Route("{$definition['#path']}/clear", [
'_title' => 'Clear',
'_form' => '\\Drupal\\checklistapi\\Form\\ChecklistapiChecklistClearForm',
'checklist_id' => $id,
'op' => 'edit',
], $requirements);
}
return $routes;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ChecklistapiRoutes:: |
public | function | Provides dynamic routes. |