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

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.

主站蜘蛛池模板: 苗栗县| 天峨县| 霞浦县| 宝兴县| 丹江口市| 唐海县| 隆子县| 泰兴市| 策勒县| 瓮安县| 富裕县| 香格里拉县| 鄄城县| 肃北| 神农架林区| 太原市| 漯河市| 蓬溪县| 喀喇沁旗| 孝感市| 阳东县| 文化| 灵寿县| 磐石市| 虹口区| 贺州市| 张家界市| 银川市| 平罗县| 马尔康县| 阿图什市| 阳曲县| 青海省| 犍为县| 阳山县| 泽库县| 图木舒克市| 临猗县| 麻阳| 昭平县| 普洱|