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

  • Drupal 8 Module Development
  • Daniel Sipos
  • 140字
  • 2021-07-02 12:22:39

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.

主站蜘蛛池模板: 蒙山县| 香格里拉县| 虞城县| 陆良县| 罗甸县| 喜德县| 淮北市| 黄陵县| 环江| 南川市| 临沂市| 伊金霍洛旗| 汉中市| 卢湾区| 霍城县| 石台县| 莱阳市| 武陟县| 师宗县| 凤庆县| 清水县| 江口县| 磐石市| 麦盖提县| 邻水| 合作市| 吴堡县| 白河县| 新宁县| 邵阳县| 锦州市| 中山市| 尼木县| 丰宁| 林周县| 祁阳县| 滁州市| 苏尼特左旗| 涪陵区| 芮城县| 房产|