class ConfigPagesRoutes in Config Pages 8
Same name and namespace in other branches
- 8.3 src/Routing/ConfigPagesRoutes.php \Drupal\config_pages\Routing\ConfigPagesRoutes
- 8.2 src/Routing/ConfigPagesRoutes.php \Drupal\config_pages\Routing\ConfigPagesRoutes
Defines dynamic routes for Config Pages.
Hierarchy
- class \Drupal\config_pages\Routing\ConfigPagesRoutes
Expanded class hierarchy of ConfigPagesRoutes
File
- src/
Routing/ ConfigPagesRoutes.php, line 11
Namespace
Drupal\config_pages\RoutingView source
class ConfigPagesRoutes {
/**
* {@inheritdoc}
*/
public function routes() {
$routes = [];
// Declare dinamic routes for config pages entities.
$types = ConfigPagesType::loadMultiple();
foreach ($types as $cp_type) {
$bundle = $cp_type
->id();
$label = $cp_type
->get('label');
$menu = $cp_type
->get('menu');
$path = isset($menu['path']) ? $menu['path'] : '';
if (!$path) {
continue;
}
$routes['config_pages.' . $bundle] = new Route($path, [
'_controller' => '\\Drupal\\config_pages\\Controller\\ConfigPagesController::classInit',
'_title' => "Edit config page {$label}",
'config_pages_type' => $bundle,
], [
'_permission' => 'edit config_pages entity',
], [
'_admin_route' => TRUE,
]);
}
return $routes;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigPagesRoutes:: |
public | function |