collectVars($input, $output, $questions); $di_question = new ConfirmationQuestion('Would you like to inject dependencies?', FALSE); if ($this->ask($input, $output, $di_question)) { $this->collectServices($input, $output); } $route_question = new ConfirmationQuestion('Would you like to create a route for this controller?'); if ($this->ask($input, $output, $route_question)) { $route_path = '/' . str_replace('_', '-', $vars['machine_name']) . '/example'; $route_questions['route_name'] = new Question('Route name', '{machine_name}.example'); $route_questions['route_path'] = new Question('Route path', $route_path); $route_questions['route_title'] = new Question('Route title', 'Example'); $route_questions['route_permission'] = new Question('Route permission', 'access content'); $this->collectVars($input, $output, $route_questions, $vars); $this->addFile() ->path('{machine_name}.routing.yml') ->template('d8/controller-route.twig') ->action('append'); } $this->addFile() ->path('src/Controller/{class}.php') ->template('d8/controller.twig'); } }