Answer the question
In order to leave comments, you need to log in
How to include dependency in drupal 8?
I decided to deal with Drupal 8. I created a controller, but how to transfer PDO and Twig instances to it, for example?
I suspect that somewhere you need to create a file like module_name.dependency.yml but Google is silent.
Answer the question
In order to leave comments, you need to log in
В общем нужно создать файл video.services.yml
services:
video.index_controller:
class: Drupal\video\Controller\VideoIndexController
arguments: ['@video.model']
video.model:
class: Drupal\video\Model\VideoModel
arguments: ['@database']
video.id:
path: '/video/{id}'
defaults:
_controller: 'Drupal\video\Controller\VideoIndexController::video'
requirements:
_permission: 'access content'
video.id:
path: '/video/{id}'
defaults:
_controller: 'video.index_controller:video'
requirements:
_permission: 'access content'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question