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

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 needs to be 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.

主站蜘蛛池模板: 六枝特区| 祁东县| 香河县| 包头市| 和龙市| 石林| 神农架林区| 清镇市| 墨竹工卡县| 泸定县| 葫芦岛市| 建德市| 马尔康县| 河池市| 神池县| 定远县| 乌拉特前旗| 祥云县| 睢宁县| 柯坪县| 报价| 贡觉县| 武邑县| 临猗县| 丘北县| 安吉县| 武乡县| 盘山县| 竹溪县| 宁陕县| 泗阳县| 奇台县| 大悟县| 新丰县| 新宁县| 丹巴县| 龙州县| 资中县| 博湖县| 阜南县| 湄潭县|