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

  • 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.

主站蜘蛛池模板: 阿尔山市| 保康县| 贵港市| 湘西| 额济纳旗| 福鼎市| 赫章县| 丰顺县| 盱眙县| 大厂| 邹平县| 阿拉善左旗| 宁海县| 丹东市| 新绛县| 静安区| 利辛县| 哈密市| 彰武县| 富锦市| 阿拉善右旗| 定西市| 阿城市| 东安县| 郸城县| 建湖县| 延吉市| 高邮市| 革吉县| 八宿县| 建德市| 金溪县| 富蕴县| 蓬溪县| 东光县| 苗栗市| 扎兰屯市| 新乐市| 织金县| 嘉祥县| 新安县|