info.yml file, add these lines: components:įor more information about how to use this module, read the Components documentation. Here's how you would register a "myLib" component library in your theme's or module's. The Components module allows you to specify a different directory for you component library's Twig files and allows you to register a unique Twig namespace for those files. But Drupal core makes it very difficult to use Twig templates not placed in a /templates directory. Ideally, we would put our component library's Twig templates in a separate directory from the Drupal-style Twig templates. Instead, Drupal core registers a Twig namespace for every module and theme in your installation ( etc.) And all of those Twig templates are designed for specific Drupal theme hooks and data (nodes, comments, views, etc.) and must be placed in a /templates directory inside a module or theme. Modern front-end development techniques means a website needs a component library where each component is concerned about a specific design element.īut Drupal core does not yet provide a component library for its design. The text, indicates the Twig namespace we wish to use when getting the twig template. Much more to follow on this game that has swallowed up so many days of our existence. We haven’t managed to get any of the Tapani patches running though. Drupal core registers many Twig namespaces so that you can reference the Twig templates from specific modules or themes. Unusually CM01/02 does not install out of the box in PlayOnMac / PlayOnLinux it will install manually though, and you can patch the game to 3.9.68. Twig natively offers a feature called “template namespaces”. It allows themes (and modules) to register Twig namespaces and provides some additional Twig functions and filters for use in Drupal templates. The Components module makes it easier for a theme to organize its components.