Skip to content

Commit 7b98a91

Browse files
authored
Fix "Create Form Builder Form attribute" (#2402)
1 parent d8e3caa commit 7b98a91

File tree

9 files changed

+20
-10
lines changed

9 files changed

+20
-10
lines changed

code_samples/forms/custom_form_attribute/config/packages/form_attribute_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ibexa_form_builder:
22
fields:
33
checkbox_with_richtext_description:
4-
name: Checkbox with RichtextDescription
4+
name: Checkbox with Rich Text description
55
category: Default
66
thumbnail: '/bundles/ibexaicons/img/all-icons.svg#input-line'
77
attributes:

code_samples/forms/custom_form_attribute/webpack.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ if (isReactBlockPathCreated) {
4646

4747
Encore.addEntry('app', './assets/app.js');
4848

49-
Encore.addEntry('formbuilder-richtext-checkbox-js', [
50-
path.resolve('./public/js/formbuilder-richtext-checkbox.js')
51-
]);
49+
Encore.addEntry('formbuilder-richtext-checkbox-js', './assets/js/formbuilder-richtext-checkbox.js');
5250

5351
const projectConfig = Encore.getWebpackConfig();
5452

docs/content_management/forms/create_form_attribute.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ description to the Form.
1414
## Configure Form attribute
1515

1616
To create a `richtext_description` attribute,
17-
add the following configuration under the `ibexa_form_builder_fields` [configuration key](configuration.md#configuration-files):
17+
add the following configuration under the `ibexa_form_builder.fields` [configuration key](configuration.md#configuration-files):
1818

1919
``` yaml
2020
[[= include_file('code_samples/forms/custom_form_attribute/config/packages/form_attribute_config.yaml') =]]
@@ -63,15 +63,15 @@ twig:
6363
6464
## Add scripts
6565
66-
Now you need to enable the RichText editor. Provide the required script in a new `public/js/formbuilder-richtext-checkbox.js` file:
66+
Now you need to enable the Rich Text editor. Provide the required script in a new `assets/js/formbuilder-richtext-checkbox.js` file:
6767

6868
``` js
69-
[[= include_file('code_samples/forms/custom_form_attribute/public/js/formbuilder-richtext-checkbox.js') =]]
69+
[[= include_file('code_samples/forms/custom_form_attribute/assets/js/formbuilder-richtext-checkbox.js') =]]
7070
```
7171

7272
Then, paste the highlighted part of the code into the `webpack.config.js` file:
7373

74-
``` js hl_lines="49-51"
74+
``` js hl_lines="49"
7575
[[= include_file('code_samples/forms/custom_form_attribute/webpack.config.js') =]]
7676
```
7777

@@ -85,7 +85,7 @@ yarn encore dev
8585

8686
## Implement Field
8787

88-
Now you have to implement the Field, and make sure the value from the RichText attribute is passed on to the field form.
88+
Now you have to implement the Field, and make sure the value from the Rich Text attribute is passed on to the field form.
8989

9090
Create a `src/FormBuilder/Form/Type/CheckboxWithRichtextDescriptionType.php` file.
9191

@@ -118,4 +118,16 @@ In the main menu, click **Content** -> **Forms** -> **Create content**, and sele
118118

119119
You should be able to see the new section in the list of available fields:
120120

121-
![New form](new_form.png)
121+
![New form field](checkbox_with_richtext_description-item.png)
122+
123+
When editing settings, the "Description" attribute has the Rich Text input.
124+
125+
![Field settings](checkbox_with_richtext_description-edit.png)
126+
127+
When you enter the "Description" attribute, the Rich Text toolbar appears.
128+
129+
![Rich Text toolbar](checkbox_with_richtext_description-focus.png)
130+
131+
The preview displays the formatted text along with the checkbox and its label.
132+
133+
![Field preview](checkbox_with_richtext_description-preview.png)
30.4 KB
Loading
42.3 KB
Loading
24 KB
Loading
40.6 KB
Loading
-28.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)