Skip to content

Commit 6dfcf1f

Browse files
committed
Update README
1 parent 9daa8ac commit 6dfcf1f

File tree

1 file changed

+36
-14
lines changed

1 file changed

+36
-14
lines changed

README.md

+36-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Data Transform Plugin for Pattern Lab
22

3-
Since version 1.2.0 this plugin should once again work with all PatternEngines.
4-
5-
63
## Installation
74

85
To install and use the plugin run the following command in the Pattern Lab root directory:
@@ -11,7 +8,37 @@ To install and use the plugin run the following command in the Pattern Lab root
118
composer require aleksip/plugin-data-transform
129
```
1310

14-
For the `Attribute` object support to work properly, your Pattern Lab config file needs to have the following setting: `twigAutoescape: false`.
11+
12+
## Configuration options
13+
14+
For `Attribute` object support to work properly, your Pattern Lab `config.yml` file needs to have the following setting:
15+
16+
```yaml
17+
twigAutoescape: false
18+
```
19+
20+
The default values for Data Transform Plugin specific options in `config.yml` are:
21+
22+
```yaml
23+
plugins:
24+
dataTransform:
25+
enabled: true
26+
verbose: false
27+
```
28+
29+
30+
### Enabling and disabling the plugin
31+
32+
Once installed, it is possible to enable and disable Data Transform Plugin using the `enabled` setting.
33+
34+
35+
### Verbose mode
36+
37+
Occasionally it might happen that there is a problem with a data file, and PHP notices and/or warnings with long stack traces are displayed when Pattern Lab is generated. In a large project it can be difficult to find the problematic data file, but turning on Data Transform Plugin's verbose mode using the `verbose` setting can help.
38+
39+
In verbose mode Data Transform plugin reports each pattern it processes and all data transform functions performed. It also suppresses regular PHP error messages and reports about errors in an easier to read way.
40+
41+
Important note: due to the way verbose mode is implemented, it might not work if other plugins that interact with the Twig `Environment` object are used.
1542

1643

1744
## Features
@@ -25,7 +52,7 @@ Please note that global data from the `_data` directory is considered to be patt
2552

2653
### Data transform functions
2754

28-
Currently the plugin provides four transform functions for the data read by Pattern Lab. The examples provided are in JSON but Pattern Lab supports YAML too!
55+
Currently the plugin provides four transform functions for the data read by Pattern Lab. The examples provided are in JSON but Pattern Lab supports YAML too.
2956

3057

3158
#### Include pattern files
@@ -34,7 +61,7 @@ If a value contains the name of a pattern in shorthand partials syntax, the plug
3461

3562
```json
3663
{
37-
"key": "atoms-form-element-label.html"
64+
"key": "atoms-form-element-label-html"
3865
}
3966
```
4067

@@ -44,7 +71,7 @@ Advanced syntax with support for passing variables (`with`) and disabling access
4471
{
4572
"key": {
4673
"include()": {
47-
"pattern": "atoms-form-element-label.html",
74+
"pattern": "atoms-form-element-label-html",
4875
"with": {
4976
"title": "Textfield label"
5077
},
@@ -86,7 +113,7 @@ It is also possible to include [pseudo-patterns](http://patternlab.io/docs/patte
86113
}
87114
```
88115

89-
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.
116+
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.
90117

91118

92119
#### Create Drupal `Attribute` objects
@@ -126,9 +153,4 @@ The value of `key` will be replaced with an [`Attribute` object](https://www.dru
126153
}
127154
```
128155

129-
The value of `key` will be replaced with an `Url` object. Note that in the example `attributes` will be replaced with an `Attribute` object before the `Url` object is created.
130-
131-
132-
## More examples
133-
134-
Most features provided by this plugin are used in [Shila Drupal theme](https://github.com/aleksip/shila-drupal-theme).
156+
The value of `key` will be replaced with an `Url` object. Note that in the example the value of `attributes` will be replaced with an `Attribute` object before the `Url` object is created.

0 commit comments

Comments
 (0)