aleksip / plugin-data-transform

Data Transform Plugin for Pattern Lab PHP
GNU General Public License v2.0
34 stars 10 forks source link

Not able to `join()` hidden patterns with `_` prefix #2

Closed EvanLovely closed 8 years ago

EvanLovely commented 8 years ago

We're not able to use join() (I'm assuming it's the same for includes) with patterns that have a filename that starts with a _ (i.e. hidden). Let me know if you'd like some code snippets or more info. Thanks!

EvanLovely commented 8 years ago

This also applies to patterns that start with -, which are patterns that are only hidden from View All lists, but are present in the menu and can be navigated to and seen. (Yet another undocumented feature!)

anthonysimone commented 8 years ago

I'm also encountering the same issue with include(). Hiding patterns (with filename prepended with _) also hides them from view in any other pattern referencing it. If this is possible, it'd be an awesome way to clean up the final output from the project!

aleksip commented 8 years ago

This is due to the way PL core currently works: data for hidden patterns is not loaded. I have now opened a core issue suggesting ways to make the data available.

I'd be interested to learn about your use cases: what kind of patterns would you not want to show separately in the style guide but still use as a part of other patterns?

anthonysimone commented 8 years ago

Ahh, I see, that makes sense. The main use case that I've encountered so far is probably more related to the implementation of pattern lab with Drupal than pattern lab in general. Specifically, we use paragraphs a lot to build out componentized, curated content. This pattern often makes use of nested paragraphs to either allow a user to add one of a handful of components to a region, or build something like a slider, where each slide would be a paragraph nested within the main slider paragraph.

In the case of a slider, there would be a field on the parent paragraph that you would add the individual slide paragraphs to. This field behaves mostly just like a container, but it's necessary to add a field pattern so it can be included in the slider paragraph pattern. The field pattern isn't really necessary to show as it mostly just acts as a container, and additionally, styles and js are generally tied to the paragraph it is contained in, which isn't present when the field containing the individual slide paragraphs is presented on it's own, so it doesn't appear as a functioning slider.

Right now I've just sequestered these specific fields in their own category so they're out of the way, but they still show up in the View All style guide. It's definitely not the biggest deal, but it's nice to know it's related to how pattern lab core works in general.

aleksip commented 8 years ago

Joining and including hidden patterns should now work with the 2.6.3 release of Pattern Lab Core!

@anthonysimone Nice to learn about your use case, thanks for sharing it.

anthonysimone commented 8 years ago

That's awesome! I just updated and got it working. Thanks!

aleksip commented 8 years ago

Good to hear! All credit goes to @dmolsen who fixed this in PL core. Closing this issue now.