示例#1
0
 /**
  * @event kernel.controller
  * @priority 9999
  * @param FilterControllerEvent $e
  */
 static function onRequest($e)
 {
     if ($variants = Submodules::fastInvoke('route_alter_variants')[\Drupal::routeMatch()->getRouteName()] ?? NULL) {
         foreach ($variants as $variant) {
             if (!isset($variant['applies']) || is_callable($variant['applies']) && $variant['applies']()) {
                 $e->setController($variant['controller']);
                 break;
             }
         }
     }
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function routes()
 {
     $routes = [];
     foreach (Submodules::fastInvoke('route') as $name => $route) {
         $route += ['defaults' => [], 'requirements' => [], 'options' => [], 'host' => '', 'schemes' => [], 'methods' => [], 'condition' => ''];
         $routes[$name] = new Route($route['path'], $route['defaults'], $route['requirements'], $route['options'], $route['host'], $route['schemes'], $route['methods'], $route['condition']);
     }
     $dispatcher = \Drupal::service('event_dispatcher');
     foreach (_d_submodules_event_map() as $event) {
         if ('routing.route_alter' === $event[0]) {
             call_user_func_array([$dispatcher, 'addListener'], $event);
         }
     }
     return $routes;
 }
示例#3
0
 /**
  * @implement library_info_alter
  */
 static function libraryInfo(&$libraries, $extension)
 {
     $libraries += Submodules::fastInvoke('submodule_library_info')[$extension] ?? [];
 }