- Drupal 8 Module Development
- Daniel Sipos
- 133字
- 2021-07-02 15:45:14
Namespaces
Before moving on with the Controller we set out to write, let's break down the namespace situation in Drupal 8 and how the folder structure is inside a module.
Drupal 8 uses the PSR-4 namespace autoloading standard. In effect, this means that the namespace of all Drupal core and module classes starts with \Drupal. For modules, the base namespace is \Drupal\module_name, where module_name is the machine name of the module. This then maps to the /src folder found inside the module directory (for main integration files). For PHPUnit tests, we have a different namespace, as we will see later in the book.
So essentially, we will need a /src folder inside our module to place all of our classes that need to be autoloaded. So, we can go ahead and create it.
- Spring 5.0 Microservices(Second Edition)
- 精通JavaScript+jQuery:100%動(dòng)態(tài)網(wǎng)頁(yè)設(shè)計(jì)密碼
- PHP 從入門(mén)到項(xiàng)目實(shí)踐(超值版)
- Cocos2d-x游戲開(kāi)發(fā):手把手教你Lua語(yǔ)言的編程方法
- 信息可視化的藝術(shù):信息可視化在英國(guó)
- 青少年美育趣味課堂:XMind思維導(dǎo)圖制作
- 編程珠璣(續(xù))
- SQL語(yǔ)言從入門(mén)到精通
- Creating Stunning Dashboards with QlikView
- Learning Splunk Web Framework
- 貫通Tomcat開(kāi)發(fā)
- 深度實(shí)踐KVM:核心技術(shù)、管理運(yùn)維、性能優(yōu)化與項(xiàng)目實(shí)施
- AI自動(dòng)化測(cè)試:技術(shù)原理、平臺(tái)搭建與工程實(shí)踐
- Web前端測(cè)試與集成:Jasmine/Selenium/Protractor/Jenkins的最佳實(shí)踐
- Microsoft Dynamics GP 2013 Cookbook