ChecklistapiRoutes.php in Checklist API 8
File
src/Routing/ChecklistapiRoutes.php
View source
<?php
namespace Drupal\checklistapi\Routing;
use Symfony\Component\Routing\Route;
class ChecklistapiRoutes {
public function routes() {
$routes = [];
$definitions = \Drupal::moduleHandler()
->invokeAll('checklistapi_checklist_info');
foreach ($definitions as $id => $definition) {
if (empty($definition['#path']) || empty($definition['#title'])) {
continue;
}
$requirements = [
'_checklistapi_access' => 'TRUE',
];
$routes["checklistapi.checklists.{$id}"] = new Route($definition['#path'], [
'_title' => (string) $definition['#title'],
'_form' => '\\Drupal\\checklistapi\\Form\\ChecklistapiChecklistForm',
'checklist_id' => $id,
'op' => 'any',
], $requirements);
$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;
}
}