Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add core support for Data Transform Plugin requirements #1020

Open
aleksip opened this issue Jun 7, 2019 · 10 comments
Open

Add core support for Data Transform Plugin requirements #1020

aleksip opened this issue Jun 7, 2019 · 10 comments
Labels
help wanted 🆘 pinned 📌 Don't let stalebot clean this up plugin 🔌

Comments

@aleksip
Copy link
Member

aleksip commented Jun 7, 2019

Background

Data Transform Plugin is a popular (over 470 000 installs according to Packagist) plugin for Pattern Lab PHP. It is especially useful in Drupal front end development. It is possible that some users don't even realize that the features provided by Data Transform Plugin are not part of Pattern Lab PHP core.

A Node version of Data Transform Plugin would make migration from Pattern Lab PHP to Pattern Lab Node easier for many people.

Based on my limited knowledge of JavaScript and the Pattern Lab Node codebase, it seems to me that it is not currently possible to create a Node version, due to missing core support for some requirements. If it turns out that core does support all requirements, it would still be good to know the 'right' way to do these things!

Technical description and requirements

Data Transform Plugin processes data in pattern data files and makes the processed data available to patterns. Other patterns can be included in data files and pattern specific data is also made available to patterns included in the templates themselves.

@stale
Copy link

stale bot commented Aug 7, 2019

It's hard to keep track of everything. This issue has been automatically marked as stale because it has not had recent activity, neither from the team nor the community. It will be closed if no further activity occurs. Please consider adding additional info, volunteering to contribute a fix for this issue, or making a further case that this is important to you, the team, and the project as a whole. Thanks!

@sghoweri
Copy link
Contributor

+1

@christianwiedemann
Copy link

+1

@stale
Copy link

stale bot commented Dec 30, 2019

It's hard to keep track of everything. This issue has been automatically marked as stale because it has not had recent activity, neither from the team nor the community. It will be closed if no further activity occurs. Please consider adding additional info, volunteering to contribute a fix for this issue, or making a further case that this is important to you, the team, and the project as a whole. Thanks!

@stale
Copy link

stale bot commented Jan 30, 2020

Issue closed after going stale. It can be re-opened if still relevant.

@stale stale bot closed this as completed Jan 30, 2020
@juranosaurustechs
Copy link

Still interested in seeing this happen...

@aleksip aleksip reopened this Aug 18, 2020
@RainbowArray
Copy link

Aleksi mentioned this issue's existence to me, and I wanted to comment on it to make clear its importance.

The Data Transform Plugin has been absolutely critical in the work I've done integrating Drupal sites with Pattern Lab. By allowing patterns to be included through yml files, including the ability to override variables while doing so, this actually helps to replicate a similar data model to how variables work in the Drupal render system. In Drupal, higher-level templates like a page or a node pull in lower-level templates like a field through a variable that has already been rendered into a string. And essentially the Data Transform Plugin makes it simple to replicate that within the variable system in Pattern Lab, which makes it much simpler to use the same set of templates in Pattern Lab and in Drupal for front-end components.

This has become particularly important because Drupal 9 now uses Twig 2. And the original composer-based PHP version of Pattern Lab isn't really being supported anymore, so it's hard to see how that version will be upgraded to use Twig 2.

The node-based version of Pattern Lab with the PHP engine for Twig does seem much more actively maintained. However, the lack of support for plugins, particularly the Data Transform Plugin, has for me been the primary barrier for adoption. There are a lot of front-end developers in the Drupal community who make use of Pattern Lab, and the Data Transform Plugin has been a really useful tool in that process. It will be much, much easier for those developers to migrate to the node-based version of Pattern Lab if the Data Transform Plugin is available.

If that plugin is not available, frankly, I think it will be a blocker for upgrading to Drupal 9 altogether, because the barriers to dealing with that big of a change to the data model for Pattern Lab templates may be too large.

So support for this would be a huge help in adopting the node version of Pattern Lab for a lot of people in the Drupal community.

@markconroy
Copy link

I'm in pretty much the same boat as @Mdrummond

If there's anything I can do to help this issue along, I'd be happy to try take a look and/or test things.

@mariohernandez
Copy link

Throwing in my hat in here as well. The Data Transform Plugin would be a great addition to node-based Pattern Lab.

@aleksip
Copy link
Member Author

aleksip commented Nov 29, 2020

Adding the required support for plugins could prove to be a lot of work. Full PHP support would probably also require changes to both engine-twig-php and the "third-party" basalt/twig-renderer.

An alternative that has come to mind is to add (most of) Data Transform Plugin's features directly into core!

Of all DTP's features

  • Pattern-specific data file support for included patterns
  • Include pattern files
  • Include pseudo-pattern files
  • Join text values
  • Create Drupal Attribute objects
  • Create Drupal Url objects

only the last two require Twig or PHP. All other features could actually be quite useful for other (template) languages too. (Although not extensively tested, all DTP's non-Twig features should work with PL PHP's Mustache PatternEngine as well.)

PHP support would also be needed for pattern-specific data support for patterns included from Twig. But I am not sure if this is a very common use case, since usually the required variables are also passed with the Twig include.

The number one feature quite certainly is the ability to include patterns from data files. So maybe we could start with that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted 🆘 pinned 📌 Don't let stalebot clean this up plugin 🔌
Projects
None yet
Development

No branches or pull requests

8 participants