Skip to content

Commit 3edb155

Browse files
authored
Merge pull request #203 from magento-devdocs/1.0.0-beta-release
[Owls] Docs for beta 5 release
2 parents de61a63 + 2a70f4c commit 3edb155

16 files changed

+207
-79
lines changed

CONTRIBUTING.md

-37
This file was deleted.

docs/_config.page-builder.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exclude:

docs/_config.pagebuilder.yml

Whitespace-only changes.

docs/configurations/iconography.md

+115-19
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,133 @@
11
# Iconography
22

3-
<!-- {% raw %} -->
4-
53
## Overview
64

7-
PageBuilder Admin icons follow the same design principles as the core [Magento Admin icons].
8-
They are simple, flat, and monochromatic to prevent the loss of detail at smaller sizes and makes the shapes easier to comprehend.
5+
PageBuilder Admin icons follow the same design principles as the core [Magento Admin icons]. They are simple, flat, and monochromatic to prevent the loss of detail at smaller sizes, while making their shapes easier to comprehend.
6+
7+
## Page Builder icons
8+
9+
Here are the available PageBuilder Admin font icons (with class names) for use within your content type as needed:
10+
11+
![PageBuilder admin icons](../images/pagebuilder-icons.png){:width="870px" height="auto"}
12+
13+
Page Builder references these icons by their class names. For example, Page Builder's Heading content type references `icon-pagebuilder-heading` for its panel icon configuration file, as shown here:
14+
15+
```xml
16+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_PageBuilder:etc/content_type.xsd">
17+
<type name="heading"
18+
label="Heading"
19+
icon="icon-pagebuilder-heading"
20+
...>
21+
```
22+
23+
Page Builder's Heading also references three more icons in its toolbar as defined in `Magento/PageBuilder/view/adminhtml/web/js/content-type/heading/preview.js`, shown here:
24+
25+
```js
26+
{
27+
key: "text_align",
28+
type: "select",
29+
values: [{
30+
value: "left",
31+
label: "Left",
32+
icon: "icon-pagebuilder-align-left"
33+
}, {
34+
value: "center",
35+
label: "Center",
36+
icon: "icon-pagebuilder-align-center"
37+
}, {
38+
value: "right",
39+
label: "Right",
40+
icon: "icon-pagebuilder-align-right"
41+
}]
42+
}];
43+
```
44+
45+
The icons render in the Heading's toolbar, as shown here:
46+
47+
![Create config file](../images/iconography-toolbar-icons.png)
48+
49+
You can use these icon class names in your own content types or create your own icons using SVG files (recommended) or PNGs, as described next.
50+
51+
## Creating SVG or PNG icons
52+
53+
To add your own icons, we recommend creating SVG images because they are smaller and render more clearly on high-resolution screens, including mobile devices.
54+
55+
The size, appearance, and color of your images depend on where within Page Builder you want to use them. You can add icons to Page Builder in three areas:
56+
57+
- Panel
58+
- Form
59+
- Stage
60+
61+
### Panel icons
62+
63+
To create a panel icon that integrates seamlessly with the existing panel icons, use the following specifications:
64+
65+
![Create config file](../images/step6-icon-properties.png)
66+
67+
The *artboard* represents the actual width and height of your icon when it is exported from your graphics application (16 x 16px). The *artwork* represents the content of your icon. Following these dimensions to ensure your icons match the size and positioning of the existing Page Builder font icons within the panel.
68+
69+
### Form icons
70+
71+
Most of the images used in the Page Builder base forms are one of three sizes: 20 x 20px, 148 x 60px, and 194 x 98px.
72+
73+
![Create config file](../images/iconography-form-icons.png)
74+
75+
Your images should match Page Builder's images in both size and appearance. This ensures a professional, integrated look alongside Page Builder's existing icons. We recommend creating three artboards to match these three sizes. Then give your artwork 1-2 pixels of white space from the artboard's edge, as described for panel icons.
76+
77+
### Stage icons
78+
79+
Stage images can be a variety of sizes. For example, Page Builder's `cms-empty-row.svg` image (shown for an empty row, no doubt) is 468 x 103px with a color of #AAA6A0, as shown here:
80+
81+
![Create config file](../images/iconography-stage-images.png)
82+
83+
Again, take note of its simple design and subtle color.
84+
85+
## Adding your images
86+
87+
Add all your SVG and/or PNG icons to the `adminhtml/web/css/images` directory for your content type. For example, if your content type is called `example-quote`, you would put your icons in `adminhtml/web/css/images/content-type/example-quote/appearance/`, as follows:
88+
89+
![Create config file](../images/iconography-adding-icons.png)
90+
91+
## Create CSS classes
92+
93+
As discussed earlier in this topic, Page Builder references its icon fonts using class names from a variety of locations, such as the panel, the toolbar, and the visual selectors within forms. To participate in this icon system, you need to create a CSS class for each SVG and/or PNG image you want to reference by class name.
94+
95+
Add the CSS classes for your icons to your LESS file in `adminhtml` (and to the `frontend` LESS file if relevant), as shown here:
996

10-
## Icon library
97+
![Create config file](../images/step6-icon-style.png)
1198

12-
The following image shows all available PageBuilder Admin icons:
99+
The following CSS rule set shows one general way to link your icons through CSS:
13100

14-
![PageBuilder admin icons](../images/pagebuilder-icons.png)
101+
```css
102+
.icon-pagebuilder-quote {
103+
background-image: url('@{baseDir}Example_PageBuilderQuote/css/images/content-type/example-quote/appearance/icon-pagebuilder-quote.svg');
104+
width: 16px;
105+
height: 16px;
106+
}
107+
```
15108

16-
You can use these icons when extending or customizing the PageBuilder module or [create your own icons].
109+
If you are creating an icon for the panel, replace the `background-image` attribute with `content` (as described in the content type tutorial, [Step 6: Add an icon](../create-basic-content-type/step-6-add-icon.md)).
17110

18-
## Icon fonts
111+
| Attribute | Description |
112+
| ---------------------- | ------------------------------------------------------------ |
113+
| `class name` | To match the class names of Page Builder's native icons, we recommend prefixing your icon names with `icon-pagebuilder`, as we have done with the Quote panel icon. |
114+
| `background-image url` | The `url` used for the `background-image` is the most critical part of your own CSS classes. Always use the `@{baseDir}` variable followed by your full module name, followed by the path to your image, starting with `css`. When deployed, Page Builder creates a link in the static output where the browser can resolve it, as described below. |
115+
| `width` | Sets the width of the icon image. |
116+
| `height` | Sets the height of the icon image. |
19117

20-
We recommend using icon fonts to get the best quality for your icons.
21-
The PageBuilder Admin icon fonts can be found in the [cms-icons repository].
118+
When deployed, your CSS classes and links to your icons are generated in `pub/static`, as shown here:
22119

23-
If you want to add your own icons, each icon will need to be in its own SVG files. There are multiple ways to create icon fonts, here is one to get started:
120+
![Create config file](../images/step6-icon-link-static.png)
24121

25-
1. Go to <a href="https://icomoon.io/app/" target="\_blank"> https://icomoon.io/app/ </a> or download this app in Chrome web store.
122+
For more general information about Magento's Admin icons and how to create your own icons for use in Magento, take a look at these topics:
26123

27-
2. Upload your icons in SVG format into the app.
124+
* [Magento Admin icons]
125+
* [Create your own icons]
126+
* [The CMS icons repository]
28127

29-
3. Specify desired font names and specify the Unicode characters to map the icons. Setting the icons to Private User Area will disable screen-readers or other accessibility tools to read your icon's characters (read "Unicode" section here).
30128

31-
4. Then initialize a download in the app to generate the icon font and CSS style sheet.
32129

33130
[Magento Admin icons]: https://devdocs.magento.com/guides/v2.2/pattern-library/graphics/iconography/iconography.html
34-
[create your own icons]: https://devdocs.magento.com/guides/v2.2/pattern-library/graphics/iconography/iconography.html#creating-icons
35-
[cms-icons repository]: https://github.com/magento-ux/cms-icons
131+
[Create your own icons]: https://devdocs.magento.com/guides/v2.2/pattern-library/graphics/iconography/iconography.html#creating-icons
132+
[The CMS icons repository]: https://github.com/magento-ux/cms-icons
36133

37-
<!-- {% endraw %} -->

docs/create-basic-content-type/step-4-add-form.md

+76-8
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,53 @@ The Quote form is shown in full here for you to copy into your `pagebuilder_exam
102102
</settings>
103103
</dataProvider>
104104
</dataSource>
105+
<fieldset name="appearance_fieldset" sortOrder="10" component="Magento_PageBuilder/js/form/element/dependent-fieldset">
106+
<settings>
107+
<label translate="true">Appearance</label>
108+
<additionalClasses>
109+
<class name="admin__fieldset-visual-select-large">true</class>
110+
</additionalClasses>
111+
<collapsible>false</collapsible>
112+
<opened>true</opened>
113+
<imports>
114+
<link name="hideFieldset">${$.name}.appearance:options</link>
115+
<link name="hideLabel">${$.name}.appearance:options</link>
116+
</imports>
117+
</settings>
118+
<field name="appearance" formElement="select" sortOrder="10" component="Magento_PageBuilder/js/form/element/dependent-visual-select">
119+
<argument name="data" xsi:type="array">
120+
<item name="config" xsi:type="array">
121+
<item name="default" xsi:type="string">default</item>
122+
</item>
123+
</argument>
124+
<settings>
125+
<additionalClasses>
126+
<class name="admin__field-wide">true</class>
127+
<class name="admin__field-visual-select-container">true</class>
128+
</additionalClasses>
129+
<dataType>text</dataType>
130+
<validation>
131+
<rule name="required-entry" xsi:type="boolean">true</rule>
132+
</validation>
133+
<elementTmpl>Magento_PageBuilder/form/element/visual-select</elementTmpl>
134+
</settings>
135+
<formElements>
136+
<select>
137+
<settings>
138+
<options class="AppearanceSourceQuote"/>
139+
</settings>
140+
</select>
141+
</formElements>
142+
</field>
143+
</fieldset>
105144
<fieldset name="general" sortOrder="20">
106145
<settings>
107146
<label/>
108147
</settings>
109148
<field name="quote_text" sortOrder="10" formElement="textarea">
110149
<argument name="data" xsi:type="array">
111150
<item name="config" xsi:type="array">
112-
<item name="source" xsi:type="string">page</item>
151+
<item name="source" xsi:type="string">page</item>
113152
</item>
114153
</argument>
115154
<settings>
@@ -121,7 +160,7 @@ The Quote form is shown in full here for you to copy into your `pagebuilder_exam
121160
<field name="quote_author" sortOrder="20" formElement="input">
122161
<argument name="data" xsi:type="array">
123162
<item name="config" xsi:type="array">
124-
<item name="source" xsi:type="string">page</item>
163+
<item name="source" xsi:type="string">page</item>
125164
</item>
126165
</argument>
127166
<settings>
@@ -144,20 +183,49 @@ The Quote form is shown in full here for you to copy into your `pagebuilder_exam
144183
</field>
145184
<field name="quote_css" sortOrder="40" formElement="input">
146185
<argument name="data" xsi:type="array">
147-
<item name="config" xsi:type="array">
148-
<item name="source" xsi:type="string">page</item>
149-
</item>
186+
<item name="config" xsi:type="array">
187+
<item name="source" xsi:type="string">page</item>
188+
</item>
150189
</argument>
151190
<settings>
152-
<dataScope>quote_css</dataScope>
153-
<dataType>text</dataType>
154-
<label translate="true">CSS for Quote</label>
191+
<dataScope>quote_css</dataScope>
192+
<dataType>text</dataType>
193+
<label translate="true">CSS for Quote</label>
155194
</settings>
156195
</field>
157196
</fieldset>
158197
</form>
159198
```
160199

200+
### appearance fieldset and field
201+
202+
Page Builder requires you to add the `appearance_fieldset` along with its `appearance` field for all your content type forms. Even though our Quote content type doesn’t have any additional appearances, the field is still required/expected so that other modules can add appearances to your content type as needed.
203+
204+
To ensure your appearance field renders, create a `di.xml` file located here:
205+
206+
![Create config file](../images/step4-field-appearance-class.png)
207+
208+
Then add the source implementation as referenced in the `appearance` field (`<options class="AppearanceSourceQuote"/>`) as shown here:
209+
210+
```xml
211+
<?xml version="1.0"?>
212+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
213+
<virtualType name="AppearanceSourceQuote" type="Magento\PageBuilder\Model\Source\VisualSelect">
214+
<arguments>
215+
<argument name="optionsSize" xsi:type="string">large</argument>
216+
<argument name="optionsData" xsi:type="array">
217+
<item name="0" xsi:type="array">
218+
<item name="value" xsi:type="string">default</item>
219+
<item name="title" xsi:type="string" translate="true">Default</item>
220+
</item>
221+
</argument>
222+
</arguments>
223+
</virtualType>
224+
</config>
225+
```
226+
227+
Again, even though our Quote control doesn't currently define an appearance, we must implement all the parts so that other modules can expect each Page Builder content type to have an appearance defined, even if it is not used.
228+
161229
### fieldset
162230

163231
Page Builder requires fields to be grouped within named `<fieldset>` elements. Fieldsets provide your fields with a basic grouping mechanism and an optional label. You can define as many fieldsets as you want.

docs/create-basic-content-type/step-5-add-styles.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Unlike the `class` attribute, which always includes the defined classes, the `cs
2222

2323
The following diagram details how the `css` binding works starting from the HTML template (`preview.html`), the configuration (`example_quote.xml`), the form field from `pagebuilder_example_quote_form.xml`, to the CSS stylesheet (`_import.less`) and finally to the rendered HTML. The highlighted parts of the code and the arrows between them should give you a good idea for how things are connected to make the `css` binding work.
2424

25-
![Create config file](../images/step5-css-binding.png)
25+
![Create config file](../images/step5-css-binding.png){:width="745px" height="auto"}
2626

2727
As shown, the end result appends the user-entered CSS classes to the rendered template element along with any other `class` styles you already defined.
2828

@@ -71,9 +71,8 @@ If you break your styles into multiple LESS files, make sure you `@import` each
7171
The following sample shows the `class` styles used for our Quote content type:
7272

7373
```css
74-
// Content type's base styling
74+
// Content type base styling
7575
blockquote {
76-
.quote-content {
7776
display: block;
7877
font-size: 1.2em;
7978
margin: 1em;
@@ -99,7 +98,6 @@ blockquote {
9998
line-height: 0;
10099
margin-left: 0;
101100
}
102-
}
103101
}
104102
div {
105103
&.quote-author {
@@ -269,7 +267,6 @@ The `_import.less` file content for the Admin preview template:
269267
```css
270268
// Content type's base styling
271269
blockquote {
272-
.quote-content {
273270
display: block;
274271
font-size: 1.2em;
275272
margin: 1em;
@@ -295,7 +292,6 @@ blockquote {
295292
line-height: 0;
296293
margin-left: 0;
297294
}
298-
}
299295
}
300296
div {
301297
&.quote-author {
@@ -330,7 +326,6 @@ The `_import.less` file content for the master format storefront template:
330326
```css
331327
// Content type's base styling
332328
blockquote {
333-
&.quote-text {
334329
display: block;
335330
font-size: 1.2em;
336331
margin: 1em;
@@ -356,7 +351,6 @@ blockquote {
356351
line-height: 0;
357352
margin-left: 0;
358353
}
359-
}
360354
}
361355

362356
div {

docs/images/content-type-files.png

3.71 KB
Loading
26.9 KB
Loading
21.4 KB
Loading
10.6 KB
Loading
7.91 KB
Loading

docs/images/pagebuilder-icons.png

135 KB
Loading
16.7 KB
Loading

docs/images/step5-css-binding.png

207 KB
Loading
File renamed without changes.

0 commit comments

Comments
 (0)