YAML Configuration

Component ID

2899164

Component name

YAML Configuration

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

361

Component created

Component changed

Component body

Imagine a cartoon where the protagonist pulls a small pocket knife out of his pocket, selects a tool, opens it up, and an entire full-size chainsaw materializes. He finishes using it, selects another tool, and a computer pops out.... Another tool and a bicycle appears.

Y is a Swiss-army knife of magnificent proportions because it manages arrays of data in YAML configuration files and because so many aspects of Drupal are controlled with arrays of data. The Y module includes a basic set of functionality to work with fields, instances, entities, bundles, page displays, data views, layouts, themes, and more.

What simple, small, lightweight, lightning-fast module do you know of that combines much of the functionality of CTools, Features, Views, Panels, and Page Manager all together.

Not that Y has anything to do with all those steadfast Drupal modules, it doesn't. It simply gives you the ability to accomplish similar ends and with no dependencies other than that you have the PHP YAML extension set up and that you use a modern version of PHP >= 7.

How does all this work?

The YAML Configuration (Y) module lets you move bulky array definitions out of code and organize it as YAML within unifying concepts called "protocols". (If you are familiar with the concept of a CTools "plugin type", this is a close analog to a "protocol") It can be almost anything. Some protocols such as Field, Instance, Page, Layout, and Entity are built in. With these, you can define entities, fields, and instances, pages and page layouts, query-building and results displays. The ability to create bundles based on Y-defined Entities becomes quite simple.

What does all this do for you? It allows you to configure a Drupal site to a great extent using YAML and with minimal coding.

Y gives you plugin functionality and an extensive suite of YAML callables that perform important tasks like translating text (t()) and setting up paths and filenames for Drupal callbacks. You can also modularize protocols and access protocols from within other protocols. But, be careful, this can be dangerous power. It often takes careful thought.

The bottom line, though, is that the Y module lets you move configuration data out of code and into YAML configuration files, and leave just logic and control as code. It trades User Interfaces for text-editing of YAML. And, it lets you trade more than a hundred thousand of lines of code for a hundred times less code.

For an example of Y's power, look at its own hook_menu() function, and you will see what is possible.

Modules built with Y include:

This module is mirrored on: