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
Copy file name to clipboardExpand all lines: docs/create-basic-content-type/step-1-add-configuration.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -15,12 +15,12 @@ Files referenced from the configuration include the HTML templates, the JavaScri
15
15
16
16
By convention, Page Builder requires the configuration for a content type to be in the `adminhtml` area within a directory named `pagebuilder` and a subdirectory named `content_type` or `content-type`.
17
17
18
-
The name of your configuration file should also reflect the name of your content type. Our examplecontent type is called Quote, so we should name our configuration file `quote.xml` and add it to our module within the following directory structure (`view/adminhtml/pagebuilder/content_type/`):
18
+
The name of your configuration file should reflect the name of your content type preceeded by your module vendor name. For example, our module name is `Acme/PageBuilderQuote` and our content type is a quote control, so we should name our configuration file `acme_quote.xml` and add it to our module within the following directory structure (`view/adminhtml/pagebuilder/content_type/`):
If your content type name uses multiple words, use underscores to separate the words in the name.
23
+
If your content type is something with a simple or generic name like our "quote" example, include your vendor name within your configuration file name to This naming convention prevents Magento from merging your configuration file with another configuration file of the same name, or a future content type configuration file published by Magento. If your content type name uses multiple words, use underscores to separate the words.
Copy file name to clipboardExpand all lines: docs/create-basic-content-type/step-2-add-templates.md
+15-14Lines changed: 15 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,11 @@ Content type templates are the HTML files (HTML fragments) that define how your
13
13
14
14
Conventions for adding content type templates are as follows.
15
15
16
-
- Page Builder requires you to name your templates `preview.html` for the Admin template and `master.html` for the storefront template.
16
+
- Page Builder requires you to name your templates `preview.html` for the Admin preview template and `master.html` for the master format storefront template.
17
17
18
-
- Page Builder requires the name of an `appearance` to match the name of the directory containing the appearance templates. For example, `default` is the conventional name for content types with only one `appearance`. Therefore, the directory name should also be `default`.
18
+
- Page Builder requires the name of an `appearance` to match the name of the directory containing the appearance templates. If they don't match, your content type appearances will not render.
19
19
20
-
If you navigate to the Banner templates (`app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/banner`) you can see that the names of the template directories match the names of the four appearances defined in the `banner.xml` configuration file as shown here:
20
+
For example, if you navigate to the Banner's appearance templates (`app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/banner`) you can see that the names of the template directories match the names of the four appearances defined in the `banner.xml` configuration file as shown here:
21
21
22
22
```xml
23
23
<appearances>
@@ -30,10 +30,11 @@ Conventions for adding content type templates are as follows.
For content types with only one appearance (as noted in the screenshot with block), we use the name `default` for both the content type's appearance name and the name of the template directory.
33
34
34
35
## Template Configuration
35
36
36
-
The Quote example defines only one `appearance`. Therefore, by convention, set the names of the Quote `appearance` and the template directory to `default` as shown in the code and directory structure that follows:
37
+
The Quote example defines only one `appearance`. Therefore, by convention, set the name of the Quote `appearance` and the name of the template directory to `default` as shown here:
37
38
38
39
```xml
39
40
<appearances>
@@ -63,13 +64,13 @@ The following table describes each `appearance` attribute in our example.
|`name`| As noted by convention, the name of the appearance and the name of the directory for the appearance templates *must* match. |
65
66
|`default`| Every content type must have a default appearance. If you only define one appearance for your content type, you must set the default to `true`. |
66
-
|`preview_template`| References the`preview.html` template for rendering the preview appearance of your content type on the stage within the Admin UI. |
67
-
|`render_template`| References the `master.html` template for rendering the appearance of your content type on the storefront for customers to see. |
68
-
|`reader`| Reads data for the content type from the master format. |
67
+
|`preview_template`| References the`preview.html`(the Admin preview template) for rendering the preview appearance of your content type on the stage within the Admin UI. |
68
+
|`render_template`| References the `master.html`(the master format storefront template) for rendering the appearance of your content type on the storefront for customers to see. |
69
+
|`reader`| Reads content type data from the master format. |
69
70
70
71
## Quote `preview.html`
71
72
72
-
The `preview.html` template defined for the Quote appearance, is shown here in full followed by descriptions to help you understand the basics of this template.
73
+
The `preview.html` template defined for our Quote's appearance, is shown here in full followed by descriptions to help you understand the basics of this template.
73
74
74
75
```html
75
76
<!-- preview.html -->
@@ -101,7 +102,7 @@ The `preview.html` template defined for the Quote appearance, is shown here in f
101
102
102
103
### attr
103
104
104
-
The `attr` attribute allows binding of data from the content type form (UI component) to the html elements in the template. Without defining the `attr` for an HTML element in your template, bindings like `ko-style`, `css`, `html`, and `events` won't work.
105
+
The `attr` attribute allows binding of data from the content type form (UI component) to the html elements in the template.
105
106
106
107
The value for `attr` is derived from the `element` name in the configuration file followed by `attributes`. For example, the `attr` value used to bind data for the `blockquote` on line 8 of the Quote `preview.html` is `attr="data.quote.attributes"`. This corresponds to the `element` named `quote` in the `quote.xml` configuration file, as shown here:
107
108
@@ -134,9 +135,9 @@ The `ko-style` attribute applies the `<style>` attributes from the form to a tem
134
135
</element>
135
136
```
136
137
137
-
As we discuss more in [Step 4: Add form](step-4-add-form.md), the `element` styles define bindings to fields in our form. In turn, these form fields provide user-entered data or default values that we apply to the HTML elements in our templates using the `k0-style` attribute.
138
+
As we discuss more in [Step 4: Add form](step-4-add-form.md), the `element` styles define bindings to fields in our form. In turn, these form fields provide user-entered data or default values that we apply to the HTML elements in our templates using the `ko-style` attribute.
138
139
139
-
The following snippet shows the `ko-style` (Knockout binding) that applies the styles defined in the main `element` to the `div` node of the Quote's preview template:
140
+
The following snippet shows the `ko-style` (Knockout binding) that applies the styles defined in the main `element` to the `div` node of the Quote's Admin preview template:
140
141
141
142
```html
142
143
<!-- preview.html -->
@@ -168,11 +169,11 @@ The `liveEdit` binding enables end users to enter HTML content directly on the A
168
169
169
170
### event
170
171
171
-
To be completed.
172
+
The `event` attribute enables the options menu to be shown and hidden when users interact with the content type using the mouse. If you have a special circumstance with the way you wish to handle your option menus, you can modify this logic to suit your needs.
172
173
173
174
## Quote `master.html`
174
175
175
-
The `master.html` template defined for the Quote appearance is shown here in full. The same attributes and descriptions from the preview template apply to this template as well, with one addition, the `html` attribute.
176
+
The `master.html` template defined for the Quote appearance is shown here in full. The same attributes and descriptions from the Admin preview template apply to this template as well, with one addition, the `html` attribute.
176
177
177
178
```html
178
179
<!--master.html-->
@@ -209,7 +210,7 @@ The `html` attribute applies the actual user-entered HTML to the template elemen
209
210
210
211
From `liveEdit`, we see that the content of `blockquote` is bound to the `quote_text` field that stores the html.
211
212
212
-
The master template uses the `html` attribute to retrieve the HTML content and display it in the `blockquote` element:
213
+
The master format storefront template uses the `html` attribute to retrieve the HTML content and display it in the `blockquote` element:
0 commit comments