You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the plugin provides 3 transform functions for the JSON data read by Pattern Lab.
14
+
### Pattern-specific data file support for included patterns
15
15
16
+
Pattern Lab currently only supports global data files and a pattern-specific data file for the main pattern. This plugin adds pattern-specific data file support for included patterns. This feature only works with Twig PatternEngine.
16
17
17
-
### Include pattern files
18
+
19
+
### Data transform functions
20
+
21
+
Currently the plugin provides 3 transform functions for the data read by Pattern Lab. The examples provided are in JSON but Pattern Lab supports YAML too! These functions should work with both Twig and Mustache PatternEngines.
22
+
23
+
24
+
#### Include pattern files
18
25
19
26
If a value contains the name of a pattern in shorthand partials syntax, the plugin will replace the value with the rendered pattern:
20
27
@@ -43,7 +50,7 @@ Advanced syntax with support for passing variables and disabling access to the d
43
50
In both examples the value of `key` will replaced with the rendered pattern.
44
51
45
52
46
-
### Join text values
53
+
####Join text values
47
54
48
55
```json
49
56
{
@@ -62,16 +69,16 @@ In both examples the value of `key` will replaced with the rendered pattern.
62
69
The value of `key` will be replaced with the joined strings. Note that in the example `molecules-comment.html` is the name of a pattern in shorthand partials syntax. These will be replaced with the rendered pattern before the join.
63
70
64
71
65
-
### Create Drupal `Attribute` objects
72
+
####Create Drupal `Attribute` objects
66
73
67
74
```json
68
75
{
69
76
"key": {
70
77
"Attribute()": {
71
-
"id": ["edit-submit"],
72
-
"type": ["submit"],
73
-
"value": ["Submit"],
74
-
"class": ["button", "button-primary"]
78
+
"id": ["edit-submit"],
79
+
"type": ["submit"],
80
+
"value": ["Submit"],
81
+
"class": ["button", "button-primary"]
75
82
}
76
83
}
77
84
}
@@ -82,4 +89,4 @@ The value of `key` will be replaced with an [Attribute object](https://www.drupa
82
89
83
90
## More examples
84
91
85
-
All functions provided by this plugin are used extensively in [Shila Drupal Theme StarterKit](https://github.com/aleksip/starterkit-shila-drupal-theme).
92
+
All features provided by this plugin are used extensively in [Shila Drupal Theme StarterKit](https://github.com/aleksip/starterkit-shila-drupal-theme).
0 commit comments