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/overview.md
+2-11Lines changed: 2 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,5 @@
1
-
<!-- {% raw %} -->
2
-
3
1
# Overview
4
2
5
-
{: .bs-callout .bs-callout-warning }
6
-
The development of this tutorial is currently **IN PROGRESS**. A more complete rough draft is available in the How Tos section here: [How to develop a new content type](docs/how-to/how-to-develop-new-content-type.md). When this tutorial is complete, it will replace the equivalent How To topic.
7
-
8
3
Out of the box, Page Builder comes with several content types (controls) that you can drag onto the stage to build your storefront pages, as shown below. In this topic, you will learn how to create your own content type for use within Page Builder.
Copy file name to clipboardExpand all lines: docs/create-basic-content-type/step-1-add-configuration.md
+46-39Lines changed: 46 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
# Step 1: Add configuration
4
4
5
-
The configuration file gives your content type its existence. It's where you set the name, display label, and references to the other files that define the appearance and behavior of your content type. Add it to your module in the following location (`view/adminhtml/pagebuilder/content_type/`):
5
+
The configuration file gives your content type its existence. It's where you set the name, display label, and references to the other files that define the appearance and behavior of your content type. Add it to your module here (`view/adminhtml/pagebuilder/content_type/`):
@@ -14,37 +14,48 @@ The file name should reflect the name of your content type. Use underscores to s
14
14
Only a subset of configuration elements are described in this example (enough to understand the configuration file's role within a content type). For more details, refer to [Main configurations](../configurations/content-type-configuration.md) and [Additional configurations](../configurations/additional-configurations.md).
15
15
16
16
17
-
The following configuration shows the minimal requirements for defining a content type, described in the tables that follow.
17
+
The following configuration shows the minimal requirements for defining a content type called `example`. The `example` content type is nearly identical to the built-in `heading` content type in order to help you learn the fundamental parts of a content type as seen in the configuration file here. An overview of these elements and attributes are described in the tables that follow.
@@ -68,11 +79,11 @@ The `<type>` node defines the key properties of your content type. The attribute
68
79
69
80
## The `appearance` node
70
81
71
-
The purpose of the `<appearance>` node in a configuration is to define the appearance of your content type as a preview in the Admin (using the`preview.html` template) and in the storefront for customers (using the `master.html` template).
82
+
The purpose of the `<appearance>` node in a configuration is to define how your content type appears when it is dragged on the stage in the in the Admin UI (using the`preview.html` template) and when it's displayed in the storefront for customers (using the `master.html` template).
72
83
73
84
The `<appearance>` attributes are described as follows:
| name | Name of the appearance for extending as needed. |
78
89
| default | Content types must specify one of the appearances as the default appearance. That means if you only have one appearance, it must be set as the default. |
@@ -81,18 +92,14 @@ The `<appearance>` attributes are described as follows:
81
92
| reader | Reads data for the content type from the master format |
82
93
{:style="table-layout:auto"}
83
94
84
-
All content types must have at least one `<appearance>` defined within the `<appearances>`collection.
95
+
All content types must have at least one `<appearance>` defined within the `<appearances>`node.
85
96
86
-
## The `element` node
97
+
## The `elements` node
87
98
88
-
**[Dave, I know the following sentence is incorrect. Please rewrite to correct it and add more information as needed. :) ]**
89
-
90
-
The purpose of the `<element>` nodes in a configuration is to map the data from the content type from the given source back to the master format so that the content type can be updated and rendered correctly within both the Admin preview and the storefront.
91
-
92
-
**[Add table to describe element attributes and nodes]**
99
+
The purpose of `<elements>` node in the configuration is to map the data from the editor to the content type's master format so that the values entered in the editor can be stored and rendered correctly within both the Admin preview and the storefront. These nodes will be explained more fully in Step 4: Add editor.
93
100
94
101
## Next
95
102
96
-
At this point, if you try to view Page Builder you get an error noting that the `preview_template` and `render_template` from the `<appearance>` element are missing. These templates are referenced in the example config file, but we have not yet created them. Let's do that next in [Step 2: Add templates](step-2-add-templates.md).
103
+
At this point, if you try to view Page Builder you get an error noting that the `preview_template` and `render_template` from the `<appearance>` element are missing. These templates are referenced in the `example.xml` config file, but we have not yet created them. Let's do that next in [Step 2: Add templates](step-2-add-templates.md).
Copy file name to clipboardExpand all lines: docs/create-basic-content-type/step-2-add-templates.md
+50-29Lines changed: 50 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -2,53 +2,74 @@
2
2
3
3
# Step 2: Add templates
4
4
5
-
Page Builder templates are HTML files that define the appearance of content types within both the Admin UI (using the preview.html) and the storefront UI (using the master.html). Content types cannot be rendered without these templates, so let's create the ones already specified in the `<appearance>` element of our configuration file. Add them to your module in the following location (`view/adminhtml/web/template/content-type/<content-type-name>/default/`):
5
+
Templates are the HTML files that define the appearance of content types within both the Admin UI (using the `preview.html`) and the storefront UI (using the `master.html`).
1. Create the `preview_template` and `render_template` files (as noted above) within the specified directory structure, `view/adminhtml/web/template/content_type/my-content-type/default/`, using the example content that follows.
| preview_template |`preview.html` - the HTML template for rendering the preview appearance of a content type on the stage within the Admin UI. |
22
+
| render_template |`master.html` - the HTML template for rendering the appearance of a content type on the storefront for customers to see. |
23
+
24
+
## Location
25
+
26
+
Content types cannot be rendered without these templates. Add them to your module here (`view/adminhtml/web/template/content-type/<content-type-name>/default/`):
data-bind="liveEdit: { field: 'example_text', placeholder: $t('Edit Example Text') }">
45
+
</h2>
37
46
</div>
38
47
```
39
48
40
49
2. Flush your config cache `bin/magento cache:flush config` and view Page Builder from the Home Page editor (as a convenience for storefront viewing later). The Page Builder panel menu should show your content type at the top of the layout group:
Notice that you also have an options menu when you hover over your content type. This is provided by including the `<renderargs="getOptions().template" />` within your `preview.html` template. See [Option menu configurations](option-menu-configurations.md) for more details.
49
-
50
-
4. Open the Home Page on the storefront to see how the `master.html` template renders, as shown here:
A component is a JavaScript file that defines the behavior of your content type within the Admin UI stage (using preview.js). Add it to your module in the following location (`view/adminhtml/web/js/content-type/<content-type-name>/`):
5
+
Components are the JavaScript files that define the behaviors of your content type when they appear on the stage in the Admin UI (using the `preview.js` component) and in the storefront (using the `master.js` component). As such, they are complementary to the templates you added previously in Step 2.
6
+
7
+
## Configuration
8
+
9
+
Components are referenced from the `<type>` element of the configuration file as shown here:
| component | Currently there are two component types to choose from: `content-type` and `content-type-collection`. Use `Magento_PageBuilder/js/content-type` for static content types that do not have children (as shown in the example). Use `Magento_PageBuilder/js/content-type-collection` for content types that can contain children, called container content types. |
25
+
| preview_component | `preview.js` - Optional JavaScript file that provides preview-specific rendering logic within the Admin UI. If your content type does not require any specific user-interactivity or other behavior in the Admin, you can simply omit this attribute from the the `<type>`. Page Builder will use `Magento_PageBuilder/js/content-type/preview` by default. |
26
+
| master_component | `master.js` - Optional JavaScript file that provides master format rendering logic generic for all appearances of your content type when rendered on the storefront. Same as with the `preview_component`, if your content type does not require any specific user-interactivity or other behavior when it's displayed in the storefront, you can simply omit this attribute from the the `<type>`. Page Builder will use `Magento_PageBuilder/js/content-type/master` by default (as shown in the example). |
27
+
28
+
{:style="table-layout:auto"}
29
+
30
+
## Location
31
+
32
+
Add them to your module here (`view/adminhtml/web/js/content-type/<content-type-name>/`):
0 commit comments