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-4-add-form.md
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Step 4: Add form
2
2
3
-
In this step, we will create a UI component form. This form will give users another way to enter text for the quote and style its appearance.
3
+
In this step, we will create a UI component form. This form will give users another way to enter text for the Quote and style its appearance.
4
4
5
5
## About forms
6
6
@@ -70,7 +70,7 @@ The purpose of each field is described as follows:
70
70
| Quote | A textarea for writing or pasting in the quote's text. |
71
71
| Author | A text input field for the author's name. |
72
72
| Description | A text input field to describe the author's title or origin of the quote. |
73
-
| CSS for Quote | A text input field for end-users to add css class names for styling the text in the Quote field. |
73
+
| CSS for Quote | A text input field for end-users to add css class names for styling the text in the Quote field. This option is detailed in [Step 5: Add styles](step-5-add-styles.md). |
74
74
75
75
The Quote form is shown in full here for you to copy into your `pagebuilder_example_form.xml` file, followed by descriptions of the key parts.
76
76
@@ -303,7 +303,7 @@ The `<css>` element sets the binding for the CSS Classes form field (`css_classe
|`name`| Specifies the name of the form field to bind to. |
305
305
306
-
For example, in our Quote configuration, we define an `<element>` named `quote` with a `<css>` element bound to an input field in our form named `quote_css`, as shown here:
306
+
For example, in our Quote configuration, we define an `<element>` named `quote` with a `<css>` element bound to an input field in our form named `quote_css`, as shown here:
307
307
308
308
```xml
309
309
<!-- from example_quote.xml -->
@@ -338,6 +338,8 @@ And the `css` binding is applied in the `preview.html` template, as shown here:
338
338
<blockquotecss="data.quote.css"...></blockquote>
339
339
```
340
340
341
+
In [Step 5: Add styles](step-5-add-styles.md), we will revisit the `css` attribute in detail to show how it is used to allow users to style templates with additional CSS classes.
342
+
341
343
#### html
342
344
343
345
The `<html>` element binds the HTML content entered in a form field. When the `<html>` element names a field for binding, content entered into the field is applied to the template elements that use them.
As the illustration shows, 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 ensures your icons will match the size and positioning of the existing Page Builder icons within the panel.
23
+
As the illustration shows, 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 ensures your icons will match the size and positioning of the existing Page Builder icons within the panel.
24
24
25
25
When finished, add your icon to your `images` directory as follows:
26
26
@@ -36,7 +36,7 @@ The CSS for integrating SVG and PNG images with the font icons used by Page Buil
|`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 our Quote icon. |
49
-
|`content`| The relative path to your SVG or PNG icon when rendered from `pub/static`. More details follow below. |
49
+
|`content`| The relative path to your SVG or PNG icon when rendered from `pub/static`. Referencing your image from your CSS icon class ensures that the link to your image will be created in the static output and the icon will resolve in the browser. Using the `@{baseDir}` variable also ensures that the static path to your image file will resolve correctly. |
50
50
|`width`| Sets the width of the content area that most closely matches the widths of Page Builder icon fonts. |
51
51
|`height`| Sets the height of the content area that most closely matches the widths of Page Builder icon fonts. |
52
52
|`margin-bottom`| Pulls the SVG or PNG image down within the panel container to more closely match the positioning of Page Builder's font icon. |
53
53
54
-
### Content path to icon image
55
-
56
-
When you add the relative content path to your SVG or PNG image, you must start from the consolidated `styles.css` within `pub/static` as shown below.
54
+
When deployed, your icon images are linked from `pub/static` as shown here:
This referencing your image from your CSS icon class ensures that the link to your image will be created in the static output and the icon will resolve in the browser.
70
-
71
58
## Add icon class to config file
72
59
73
60
The last step is to add our icon's class name to our config file. Previous to this step, we used an existing icon class: `icon-pagebuilder-heading`. Now we can replace this class with our new class: `icon-pagebuilder-quote`, as shown here:
@@ -89,6 +76,8 @@ The last step is to add our icon's class name to our config file. Previous to th
89
76
90
77
That's it. Now you can regenerate your static assets, empty your browser cache, and do a hard reload of your Admin page to see your new icon in the panel.
91
78
79
+
## Next
92
80
81
+
Congratulations! You just finished the last step in this tutorial. To wrap things up, find out [What's next](whats-next.md).
Now that you've walked through the details and understand the basics of creating a simple content type, you are ready to tackle a more complex content type that uses containers.
4
+
5
+
See [How to develop a container content type](../how-to/how-to-develop-container-content-type.md) to get started.
0 commit comments