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
It converts an library of JSON Schemas into Drupal paragraph bundles, and the JSON schema properties are converted into Drupal fields.
10
10
@@ -73,78 +73,75 @@ The schema used by Pattern Builder is based on [JSON Schema](http://json-schema.
73
73
74
74
1. Hidden on the edit form
75
75
76
-
- Schema: `"options: { "hidden": true }`
77
76
- Drupal configuration: Field instance setting.
77
+
- Schema: `"options: { "hidden": true }`
78
78
79
79
1. Read-only on the edit form
80
80
81
-
- Schema: `"readonly": true `
82
81
- Drupal configuration: Field instance setting.
82
+
- Schema: `"readonly": true `
83
83
84
84
1. Non-imported properties:
85
85
86
86
If a property does not need to be imported as a Drupal field, then it can be flagged to not import it with:
87
87
88
-
- Schema: `"options: { "import": false }`
89
88
- Drupal configuration: None
89
+
- Schema: `"options: { "import": false }`
90
90
91
91
1. Textarea
92
92
93
93
Textareas are imported to a Drupal field type of "text_long". A schema property is consider to be a textarea if one of the following is true:
94
94
95
-
- Schema: `"format": "textarea"` OR `"format": "html"`
96
95
- Drupal configuration: Field type.
96
+
- Schema: `"format": "textarea"` OR `"format": "html"`
97
97
98
98
1. WYSIWYG / Filtered text
99
99
100
100
Filter text in Drupal provides the user with the Input Format selector. These commonly are configured to use a WYSIWYG editor.
101
101
A schema property is determined to allow filtered text if the following is set:
102
102
103
-
- Schema: `"format": "html"`
104
103
- Drupal configuration: Field instance setting.
104
+
- Schema: `"format": "html"`
105
105
106
106
1. Collapsible Field Groups and Field Collections
107
107
108
108
The [field_group](https://www.drupal.org/project/field_group) module is required by the importer in order to provide basic single level grouping. The schema can control the collapsibility of a group of properties with the following:
109
109
110
+
- Drupal configuration: Field group setting, Field Collecton Fieldset widget.
110
111
- Schema:
111
112
112
113
```
113
-
"options": {
114
-
"collapsed": true,
115
-
"disable_collapse": false
116
-
}
114
+
"options": {
115
+
"collapsed": true,
116
+
"disable_collapse": false
117
+
}
117
118
```
118
119
119
-
- Drupal configuration: Field group setting, Field Collecton Fieldset widget.
120
-
121
120
1. Form Grid Layout
122
121
123
122
This provides the ability to display grid style form elements.
124
123
125
124
- Global config: "admin/config/content/patternbuilder"
126
125
- Row class: The class for the row container in the grid layout.
127
126
- Column class prefix: The number of columns will be appended to the column class prefix. Example: "grid-columns-" results in "grid-columns-4".
128
-
127
+
- Drupal configuration: Field instance setting.
129
128
- Schema:
130
129
131
130
```
132
-
"options": {
133
-
"grid_columns": 2
134
-
},
135
-
"items": {
136
-
"format": "grid"
137
-
}
131
+
"options": {
132
+
"grid_columns": 2
133
+
},
134
+
"items": {
135
+
"format": "grid"
136
+
}
138
137
```
139
138
140
-
- Drupal configuration: Field instance setting.
141
-
142
139
1. Paragraphs preview display view mode
143
140
144
141
The importer can automatically setup up the "Paragraphs Editor Preview" view mode if the property is configured as "preview". The importer has some default formatters for some common fields (text, image). Refer to the patternbuilder_importer.api.php for hooks that allow setting custom formatters for the preview view mode.
145
142
146
-
- Schema: `"options: { "preview": true }`
147
143
- Drupal configuration: Field display view mode settings.
1. TLDR; It lets you take data from anywhere and sets it up to work with Twig rendering.
9
10
1. The library is a Symfony based PHP library that contains classes for setting data in the appropriate object layout for consumption and rendering by the Twig layer.
10
-
1.Less jargon version: It lets you take data from anywhere and sets it up to work with Twig rendering.
11
+
1.The Drupal Pattern Builder module uses this library to render the patterns while using Drupal to store the user entered data.
- Add the **latest release** of Pattern Builder library to your composer.json: `"require": {"pattern-builder/pattern-builder": "v1.1.0"}`
22
+
- Run `composer install`
23
+
- Drupal:
24
+
The Drupal [Pattern Builder module](https://www.drupal.org/project/patternbuilder) includes a composer.json with the library. The module is maintained to be compatible with library.
25
+
26
+
27
+
### Rendering a Schema
28
+
29
+
The following details how to render an example JSON schema named "band".
30
+
31
+
The Drupal Pattern Builder module automatically does all this through Drupal field storage, field widgets, and field formatters.
Copy file name to clipboardExpand all lines: docs/using_pattern_builder.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ title: Using Pattern Builder
32
32
1. Not good for complex field setups since hand mapping takes time and is error prone.
33
33
1. How:
34
34
1. Override the node view of a given content type.
35
-
1. Use the existing Drupal fields to build the render object using the PatternBuilder Library.
35
+
1. Use the existing Drupal fields to build the render object using the PatternBuilder Library. For more detail, see section ["PHP Library" > "Rendering a Schema"](pattern_builder_library.md#rendering-a-schema).
36
36
1. Set the node view content as the rendered object.
0 commit comments