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

  • Drupal 9 Module Development
  • Daniel Sipos Antonio De Marco
  • 183字
  • 2021-06-11 18:36:05

Twig

Theme engines are responsible for doing the actual output via template files. Although previous versions of Drupal were capable of using different theme engines, one stood out and was used 99.9 percent of the time (statistic made up by me on the spot): PHPTemplate. This theme engine used PHP files with the .tpl.php extension and contained both markup and PHP. Seasoned Drupal developers grew accustomed to this practice, but it was always more difficult for frontend developers to use and theme against.

Since Drupal 8, it was abandoned in favor of the Twig templating engine created by SensioLabs (the people responsible for the Symfony project). As mentioned, theme functions were also deprecated in favor of outputting everything through a Twig file. This brought about many improvements to the theme system and quite some joy to the frontend community. For example, it has improved security and readability, and has made it much less important to be actually versed in PHP to be able to take part in the theming of a Drupal site.

All Twig template files in Drupal have the .html.twig extension.

主站蜘蛛池模板: 蓬溪县| 哈尔滨市| 云梦县| 镇沅| 锡林郭勒盟| 寿光市| 二连浩特市| 石林| 会泽县| 新田县| 泰宁县| 礼泉县| 鄂州市| 宝坻区| 周至县| 武汉市| 博乐市| 北京市| 商水县| 碌曲县| 潍坊市| 犍为县| 吴堡县| 无为县| 登封市| 南郑县| 邵阳市| 云安县| 门源| 临西县| 双城市| 陈巴尔虎旗| 富民县| 广南县| 屏山县| 枣阳市| 滨州市| 盘山县| 基隆市| 肇东市| 怀安县|