PHPackages                             aleksip/plugin-drupal-definitions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. aleksip/plugin-drupal-definitions

ActivePatternlab-plugin[Utility &amp; Helpers](/categories/utility)

aleksip/plugin-drupal-definitions
=================================

Drupal Definitions Plugin for Pattern Lab PHP

212[1 issues](https://github.com/aleksip/plugin-drupal-definitions/issues)PHP

Since Dec 5Pushed 7y ago2 watchersCompare

[ Source](https://github.com/aleksip/plugin-drupal-definitions)[ Packagist](https://packagist.org/packages/aleksip/plugin-drupal-definitions)[ RSS](/packages/aleksip-plugin-drupal-definitions/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Drupal Definitions Plugin for Pattern Lab
=========================================

[](#drupal-definitions-plugin-for-pattern-lab)

Use Drupal `.layouts.yml` definition files as pattern data files.

Installing
----------

[](#installing)

To install and use the plugin run the following command in the Pattern Lab root directory:

```
composer require aleksip/plugin-drupal-definitions
```

This plugin works with pattern-specific `.layouts.yml` files. To be able to use the same files in Drupal, you can install the [Multiple Definition Files](https://github.com/aleksip/multiple_definition_files) module.

Usage
-----

[](#usage)

Example `example_card.layouts.yml`:

```
# This key is not used by the plugin for anything.
#
# The plugin supports multiple layout definitions in one file if that is
# required for some reason.
example_card:

  # This is the regular layout definition part.

  label: 'Example card'
  category: 'Cards'

  # Please note that Drupal requires layout templates to use the .html.twig
  # suffix, which is left out in layout definitions.
  #
  # The plugin expects the template file to be in the same directory as the
  # layout definition file. The path part is only used by Drupal.
  #
  # Pattern Lab shorthand syntax uses the template name without the .twig suffix
  # so this pattern would be molecules-example-card-html.
  template: dist/_patterns/01-molecules/cards/example-card/example-card

  regions:
    card_type:
      label: Card type
    image:
      label: Image
    date:
      label: Date
    title:
      label: Title
    text:
      label: Text

  # This additional key is used by the plugin. Nothing under it is used by
  # Drupal core.
  example_values:

    # The 'base' key is reserved for base pattern data.
    base:

      # The 'meta' section is for pattern documentation metadata. This
      # is equivalent to the YAML front matter section of a Pattern Lab .md
      # documentation file. These values are merged with the contents of a
      # possible documentation file, so .md files can still be used for markdown
      # content.
      meta:

        title: 'Example card'
        state: inprogress

      # The 'data' section is for pattern data.
      data:

        card_type: 'Lorem ipsum'

        # It is possible to use Data Transform Plugin features too!
        image: atoms-img-3x2

        date: '19.11.2018'
        title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit'
        text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
          eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
          minim veniam, quis nostrud exercitation ullamco laboris nisi ut
          aliquip ex ea commodo consequat."

    # All other keys under 'example_values' are used to create pseudo-patterns.
    # Pseudo-pattern data is merged with base pattern data just like with
    # regular pseudo-pattern data files.

    # The key is used as the name of the pseudo-pattern. So in Pattern Lab
    # shorthand syntax this pseudo-pattern would be
    # molecules-example-card-html-news-item.
    news-item:

      # You can leave either 'meta' or 'data' out if not needed.

      data:
        card_type: 'News item'

    # It is also possible to hide the pseudo-patterns just like with regular
    # pseudo-pattern data files, by adding an underscore to the beginning of the
    # pseudo-pattern key name.
    _event-1:

      data:

        # Yes, it is possible to use all Data Transform Plugin features!
        attributes:
          Attribute():
            class:
              - example-card
              - example-card--event
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/dac531c15d447cbc140ea8fda8f6632fe9caf8a7e3dba90bca46c1cbf46bd9fc?d=identicon)[aleksip](/maintainers/aleksip)

---

Top Contributors

[![aleksip](https://avatars.githubusercontent.com/u/1181287?v=4)](https://github.com/aleksip "aleksip (3 commits)")

### Embed Badge

![Health badge](/badges/aleksip-plugin-drupal-definitions/health.svg)

```
[![Health](https://phpackages.com/badges/aleksip-plugin-drupal-definitions/health.svg)](https://phpackages.com/packages/aleksip-plugin-drupal-definitions)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
