- Drupal 9 Module Development
- Daniel Sipos Antonio De Marco
- 432字
- 2021-06-11 18:36:03
Summary
In this chapter, we covered a great deal of info about the things you need to know when developing Drupal 9 modules. The first thing we did was create our very own module skeleton that can be installed on a Drupal site. Then, we saw how to create a new page at a specific path (route) and show some basic data on that page. Nothing too complex, but enough to illustrate one of the most common tasks you will do as a module developer. We then took that to a new level and abstracted the logic for that data calculation into a service. Not only that, but we also saw how we can use that service and, more importantly, how we should use it. Next, we saw how we can work with the Form API to allow administrators to add some configuration to the site. Also, since we talked about forms, we saw how we can alter existing ones defined by other modules—a useful technique for any module developer.
Next, we created our first custom block, which allowed us to reuse our service and be more flexible with where we show our data.
Then, we looked at how to create URLs and links programmatically. In the functionality we built in this module, we don't need any links, yet. However, it is common practice to work with them, so we had to learn early how to generate links and work with URLs properly in Drupal.
In the last section, we explored the Symfony Event Dispatcher component, something that allows us to dispatch and subscribe to events. We saw some examples of how we can subscribe to one of the main Kernel events in order to redirect the page, but we also saw how to dispatch our own event. The latter was meant to allow subscribers to make changes to our data.
Most of the topics we covered in this chapter were meant to give you an initial boost and the tools to start developing modules in Drupal 9. They represent the absolute most common things—I believe—that any new Drupal developer encounters and has to do.
In the next chapter, we will look at two important aspects most applications will need to use. One is logging—the better your site logs its errors and important actions, the easier it will be to debug and trace back issues. Another is mailing. Websites usually need to send out emails to users in one way or another, so it's important that we see how that works in Drupal 9.
- 淘寶網(wǎng)店運營與管理(微課版)
- 引爆私域流量池:新零售時代如何低成本實現(xiàn)爆發(fā)式增長
- 新興電子商務(wù)消費者信任和購買行為研究
- 網(wǎng)上開店大贏家:女裝服飾店怎樣開
- 在家就能做的99種網(wǎng)上生意
- 電子商務(wù)數(shù)據(jù)分析與應(yīng)用
- 移動支付這么玩就對了
- 新商業(yè)模式創(chuàng)新設(shè)計:當資本插上“互聯(lián)網(wǎng)+”的翅膀
- 贏在互聯(lián)網(wǎng)思維:15位網(wǎng)絡(luò)創(chuàng)富精英如是說
- 電商數(shù)據(jù)分析與數(shù)據(jù)化營銷
- 國際商務(wù)—理論與實務(wù)
- 玩爆電商運營:運營管理+美工營銷+爆款引流+玩法轉(zhuǎn)型
- 互聯(lián)網(wǎng)+:跨界與融合
- 用戶畫像:全渠道畫像方法與實踐
- “大阿里”戰(zhàn)略下黃金法典:網(wǎng)店創(chuàng)富密碼Ⅱ