2017 © Pedro Peláez
 

drupal-module unified-twig-extensions

Share Pattern Lab's custom Twig extensions with Drupal 8.

image

drupal-pattern-lab/unified-twig-extensions

Share Pattern Lab's custom Twig extensions with Drupal 8.

  • Tuesday, August 8, 2017
  • by EvanLovely
  • Repository
  • 2 Watchers
  • 4 Stars
  • 21,284 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 3 Open issues
  • 3 Versions
  • 55 % Grown

The README.md

Unified Twig Extensions

Share Pattern Lab's custom twigs functions, filters and tags with Drupal 8. Huzzah!, (*1)

Getting Started

Simply add to Drupal and enable the Unified Twig Extensions module on the admin/modules page to get started., (*2)

Note on Paths

Note: currently looks for compatible extensions in your current active D8 theme path + either the 'pattern-lab/source/_twig-components' or 'source/_twig-components' folders. @TODO: allow users to customized / override this!, (*3)

Included Examples

I'm including a couple example twig extensions to add to your existing Pattern Lab-enabled theme to get started: 1. example/_twig-components/functions/link.function.php --> example of having Drupal ignore a PL Twig extension given the link function already exists in Drupal., (*4)

  1. example/_twig-components/tags/grid.tag.php and example/_twig-components/tags/cell.tag.php --> example of a custom Twig tag that abstracts away some of the markup involved in an ITCSS-based grid system., (*5)

    To test this out, try adding these two custom Twig tags to your theme's existing _twig-components folder and try adding the following HTML (to both PL's twig templates and/or a Drupal template):, (*6)

{% grid 'o-grid--large' %}
  {% cell 'u-1/1 u-1/2@small u-2/3@medium' %}
    Grid cell
  {% endcell %}

  {% cell 'u-1/1 u-1/2@small u-1/3@medium' %}
    Grid cell
  {% endcell %}
{% endgrid %}

Everything should be working as expected if you don't encounter any errors and the following HTML gets output (rendered of course):, (*7)

```html, (*8)

Grid cell
Grid cell

```, (*9)

The Versions

08/08 2017

dev-master

9999999-dev

Share Pattern Lab's custom Twig extensions with Drupal 8.

  Sources   Download

08/08 2017

v0.1.0

0.1.0.0

Share Pattern Lab's custom Twig extensions with Drupal 8.

  Sources   Download

08/08 2017

dev-develop

dev-develop

Share Pattern Lab's custom Twig extensions with Drupal 8.

  Sources   Download