官术网_书友最值得收藏!

Invoked Controllers

Now that we know what routes, Controllers and services are, I'd also like to quickly note that Controllers can be defined as services and invoked by the routing system. In other words, just as we defined our hello_world.salutation service, we could define another one that would act as a Controller and reference that service ID in the routing file instead of the fully qualified class name. Then, in order for Drupal to know which method inside the service to call when a user accesses the route, we would need to implement the magic __invoke method inside the service. And the rest would work pretty much in the same way.

This capability was introduced in Drupal 8.7 and is typical to the Action-Domain-Responder architectural pattern. We won't use it going forward but it's good to know that it's available.

主站蜘蛛池模板: 延边| 广平县| 海宁市| 巨野县| 遵义县| 华宁县| 丰原市| 平谷区| 本溪| 台南市| 库伦旗| 呼玛县| 邵阳县| 永安市| 济南市| 开化县| 东城区| 勐海县| 水城县| 通江县| 九龙坡区| 甘孜县| 扎赉特旗| 昌吉市| 山西省| 上林县| 轮台县| 石台县| 三原县| 安远县| 丽江市| 庄河市| 腾冲县| 和林格尔县| 旬邑县| 高平市| 新丰县| 山阴县| 吉水县| 伊春市| 萍乡市|