Skip to content

Commit 4800d1b

Browse files
committed
Merge branch 'MAGEDOC-3550' into develop
2 parents 15fdd75 + d60da54 commit 4800d1b

19 files changed

+387
-56
lines changed

docs/create-custom-content-type/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ And the same three Quote controls are shown rendered here on a mock testimonial
1616

1717
## Quote module
1818

19-
As with most things in Magento, content types for Page Builder are housed in modules. The convention for naming modules that are solely dedicated to Page Builder, such as our Quote content type, is to prefix all the content type name with `PageBuilder`. This helps visually group content type modules within your vendor directory. Of course, this convention doesn't apply If you are adding a content type as part of an existing module.
19+
As with most things in Magento, content types for Page Builder are housed in modules. The convention for naming modules that are solely dedicated to Page Builder, such as our Quote content type, is to prefix all content type names with `PageBuilder`. This helps visually group content type modules within your vendor directory. Of course, this convention does not apply if you are adding a content type as part of an existing module.
2020

2121
Applying this convention to the module for our Quote content type, we get the name `PageBuilderQuote`, and can set up our module as shown here:
2222

@@ -28,7 +28,7 @@ After registering your module (`bin/magento setup:upgrade`) you will be ready to
2828

2929
The steps for creating the Quote content type are illustrated and described below. The reality is not quite this linear, but these steps do represent the basic phases and flow for building new Page Builder content types.
3030

31-
![Creating Custom Content Types](../images/content-type-overview.png)
31+
![Creating Custom Content Types](../images/content-type-overview.svg)
3232

3333
1. **Add configuration**: Create an XML file to define your content type and reference the other files that control the appearance and behavior of your content type.
3434
2. **Add templates**: Create HTML templates that define the appearance of your content types on the Admin stage (`preview.html`) and the storefront (`master.html`).
Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
11
# Overview
22

3-
This topic is currently under development. It will be completed by the GA release of Page Builder.
3+
One of quickest ways to customize Page Builder is by changing how _existing_ content types look and behave. End-users can already edit Page Builder's content types in several ways. But sometimes your end-users will want to change the structure or modify properties that do not exist on a given content type. In those cases, you can extend an existing content type by customizing its existing _appearance_ or adding a new _appearance_.
4+
5+
## Appearances
6+
7+
An **appearance** is an XML element in a content type's configuration file that lets you modify existing properties, templates, styles, and form fields, or create new ones. In other words, all Page Builder content types (existing or custom) are extended through appearances.
8+
9+
Many of Page Builder's content types have only one `appearance` element. These include the Heading, Text, Image, Video, Tabs, and more. Other content types have several appearances. For example, the Banner content type has four appearances, as shown here:
10+
11+
![banner-appearances](../images/banner-appearances.png)
12+
13+
Page Builder defines these appearances in the Banner's configuration file (`Magento/PageBuilder/view/adminhtml/pagebuilder/content_type/banner.xml`), as shown here:
14+
15+
```
16+
<appearances>
17+
<appearance name="collage-left"...>
18+
<appearance name="collage-centered"...>
19+
<appearance name="collage-right"...>
20+
<appearance name="poster" default="true" ...>
21+
</appearances>
22+
```
23+
24+
Within each `appearance` element, you can change content types in the following ways:
25+
26+
- Add new style properties.
27+
- Add or change templates.
28+
- Add to or change existing forms.
29+
- Add new attributes.
30+
- Move data between elements.
31+
32+
## Banner extension tutorial
33+
34+
In this tutorial, you will extend the Banner content type by adding a new `max-height` style property to two of the Banner's existing appearances: `collage-left` and `collage-right`.
35+
36+
![Page Builder Banner menu item](../images/extend-banner-menu.png){:width="815px" height="auto"}
37+
38+
## Banner extension steps
39+
40+
These steps show the basic pattern for adding style properties using existing appearances to extend a content type:
41+
42+
![Creating Custom Content Types](../images/extension-steps-overview.svg)
43+
44+
1. **Create an extension module**: Create a basic module for your Banner extensions.
45+
2. **Extend appearances**: Extend the existing content type's configuration file by customizing an existing appearance with new style properties.
46+
3. **Extend forms**: Extend the existing content type's UI component form by adding new form fields and changing defaults for existing fields.
47+
48+
## Next
49+
50+
[Step 1: Create an extension module](step-1-create-extension-module.md)
51+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Step 1: Create an extension module
2+
3+
Appearance extensions for Page Builder are implemented using modules. In this step, we will create an empty module so we can add our appearance and form extensions in steps 2 and 3, as shown here:
4+
5+
![Completed extension file structure](../images/extension-file-structure-complete.png){:width="826px" height="auto"}
6+
7+
## Add directory structure
8+
9+
To create a module for the Banner extensions, name your vendor directory `Example` and name your module `PageBuilderExtensionBanner`, as shown here:
10+
11+
![Minimum extension module structure](../images/banner-extension-file-structure.png){:width="530px" height="auto"}
12+
13+
The convention for naming extension modules is to prefix your extension of an existing content type with `PageBuilderExtension`, followed by the name of the content type. This is not a required convention, but we find that it helps visually group extension modules within your vendor directory.
14+
15+
## Add module file
16+
17+
Your module file should look like this:
18+
19+
```xml
20+
<?xml version="1.0"?>
21+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
22+
<module name="Example_PageBuilderExtensionBanner" setup_version="1.0.0">
23+
<sequence>
24+
<module name="Magento_PageBuilder"/>
25+
</sequence>
26+
</module>
27+
</config>
28+
```
29+
30+
## Add registration file
31+
32+
Your registration file should look like this:
33+
34+
```php
35+
<?php
36+
37+
use \Magento\Framework\Component\ComponentRegistrar;
38+
39+
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Example_PageBuilderExtensionBanner', __DIR__);
40+
```
41+
42+
## Install your module
43+
44+
From your Magento root directory, use `bin/magento setup:upgrade` to install and enable your module.
45+
46+
## Next
47+
48+
[Step 2: Extend appearances](step-2-extend-appearances.md)
49+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Step 2: Extend appearances
2+
3+
In progress. To be officially published on 3/26
4+
5+
6+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Step 3: Extend forms
2+
3+
In progress. To be officially published on 3/26
4+

docs/how-to/how-to-add-appearance.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
# How to add an appearance
22

3+
This topic describes how to add a new appearance to a content type so that you can give end-users the custom features they require when creating content.
4+
5+
![How to add an appearance](../images/how-to-add-appearance.svg)
6+
7+
## Step 1: Add appearance to config file
8+
39
In progress...

docs/how-to/how-to-add-storefront-widget.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# How to add a storefront widget
22

3-
A storefront widget is a JavaScript component that handles the behavior of a content type after Page Builder renders it on the storefront.
4-
For example, the Tabs and Sliders have their own storefront widgets to handle the end-user's tapping of tabs and swiping of slides on the storefront.
5-
However, Page Builder also executes storefront widgets on the Admin stage for block and dynamic block content types.
6-
This allows end-users to preview how Page Builder will render the blocks and dynamic blocks on the storefront.
3+
A storefront widget is a JavaScript component that handles the behavior of a content type after Page Builder renders it on the storefront. For example, the Tabs and Sliders have their own storefront widgets to handle the end-user's tapping of tabs and swiping of slides on the storefront.
4+
5+
However, Page Builder also executes storefront widgets on the Admin stage for block and dynamic block content types. This allows end-users to preview how Page Builder will render the blocks and dynamic blocks on the storefront.
76

87
Adding a storefront widget to your content type is a simple two-step process:
98

51.6 KB
Loading
62.6 KB
Loading

0 commit comments

Comments
 (0)