Skip to content

Commit 3830543

Browse files
committed
Added documentation for udw_config_name (#2719)
* Added documentation for udw_config_name * Removed conflict resolution leftover * Refactored the custom block example, added embedvideo * Fixed typo
1 parent b72713f commit 3830543

File tree

4 files changed

+21
-43
lines changed

4 files changed

+21
-43
lines changed

code_samples/page/custom_page_block/config/packages/page_blocks.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ ibexa_fieldtype_page:
3434
event:
3535
type: embed
3636
name: Event
37+
options:
38+
udw_config_name: block_event_embed
3739
validators:
3840
not_blank:
3941
message: Please select an event
Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{% extends '@IbexaPageBuilder/page_builder/block/config.html.twig' %}
22

3-
{% block content %}
4-
{% set form_templates = [_self] %}
5-
{{ parent() }}
6-
{% endblock %}
7-
83
{% block basic_tab_content %}
94
<div class="ibexa-block-config__fields">
105
{{ form_row(form.name) }}
@@ -21,15 +16,3 @@
2116
{% endif %}
2217
</div>
2318
{% endblock %}
24-
25-
{% block block_configuration_attribute_embed_widget %}
26-
{% set attr = attr|merge({'hidden': true}) %}
27-
{{ form_widget(form, {'attr': attr})}}
28-
<div class="ibexa-pb-block-embed-field">
29-
{% include '@IbexaPageBuilder/page_builder/block/config/embed_button.html.twig' with {
30-
udw_config_name: 'block_event_embed',
31-
data_open_udw: 'data-open-udw-embed'
32-
} %}
33-
{% include '@IbexaPageBuilder/page_builder/block/config/embed_preview.html.twig' %}
34-
</div>
35-
{% endblock %}

docs/content_management/pages/create_custom_page_block.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ The following example shows how to create a block that showcases an event.
1818
First, add the following [YAML configuration](configuration.md#configuration-files):
1919

2020
``` yaml
21-
[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 6) =]][[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 16, 47) =]]
21+
[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 6) =]][[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 16, 49) =]]
2222
```
2323

2424
`event` is the internal name for the block, and `name` indicates the name under which the block is available in the interface.
2525
You also set up the category in the **Page blocks** toolbox that the block appears in.
26-
In this case, it doesn't show with the rest of the built-in blocks, but in a separate "Custom" category.
26+
In this case, it doesn't show up with the rest of the built-in blocks, but in a separate "Custom" category.
2727
The thumbnail for the block can be one of the pre-existing icons, like in the example above, or you can use a custom SVG file.
2828

2929
A block can have multiple attributes that you edit when adding it to a page.
@@ -36,6 +36,15 @@ The `not_blank` validators in the example ensure that the user fills in the two
3636
The `content_type` validator in the example ensure that the user choose a content item of the content type `event`.
3737
The `regexp` validator ensure that the final value looks like a content ID.
3838

39+
The following UDW configuration is used with the `udw_config_name` key so only an event typed content item can be selected:
40+
41+
``` yaml
42+
[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 50, 59) =]]
43+
```
44+
45+
For more information, see [UDW configuration](browser.md#udw-configuration).
46+
47+
3948
## Add block templates
4049

4150
A block can have different templates that you select when adding it to a page.
@@ -121,22 +130,6 @@ Place the edit template in `templates/themes/<your_theme>/blocks/event/config.ht
121130
[[= include_file('code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig') =]]
122131
```
123132

124-
This example template overrides the `embed` attribute widget to customize the Universal Discovery Widget (UDW).
125-
It adds itself to the `form_templates` and defines a `block_configuration_attribute_embed_widget` block.
126-
The following UDW configuration is used so only an `event` typed content item can be selected:
127-
128-
``` yaml
129-
[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 48, 57) =]]
130-
```
131-
132-
For more information, see [UDW configuration](browser.md#udw-configuration).
133-
134-
Your custom page block is now ready.
135-
136-
!!! caution
137-
138-
Before you can use it in Page Builder, you must [enable it in Page field settings]([[= user_doc =]]/content_management/configure_ct_field_settings/#block-display).
139-
140133
Your custom page block is now registered in the system.
141134

142135
!!! caution

docs/content_management/pages/page_block_attributes.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ The following attribute types are available:
3030
|`url`|URL|-|
3131
|`text`|Text block|-|
3232
|`richtext`|Rich text block (see [creating RichText block](create_custom_richtext_block.md))|-|
33-
|`embed`|Embedded content item|-|
34-
|`select`|Drop-down with options to select|`choices` lists the available options in `label: value` form</br>`multiple`, when set to true, allows selecting more than one option.
33+
|`embed`|Embedded content item|`udw_config_name`: name of the [Universal Discovery Widget's configuration](browser.md#add-new-configuration) |
34+
|`embedvideo`|Embedded content item|`udw_config_name`: name of the [Universal Discovery Widget's configuration](browser.md#add-new-configuration) |
35+
|`select`|Drop-down with options to select|<ul><li>`choices` lists the available options in `label: value` form</li><li>`multiple`, when set to true, allows selecting more than one option</li></ul>|
3536
|`checkbox`|Checkbox|Selects available option if `value: true`.|
3637
|`multiple`|Checkbox(es)|`choices` lists the available options in `label: value` form.|
3738
|`radio`|Radio buttons|`choices` lists the available options in `label: value` form.|
38-
|`locationlist`|Location selection|-|
39+
|`locationlist`|Location selection| `udw_config_name`: name of the [Universal Discovery Widget's configuration](browser.md#add-new-configuration) |
3940
|`contenttypelist`|List of content types|-|
4041
|`schedule_events`,</br>`schedule_snapshots`,</br>`schedule_initial_items`,</br>`schedule_slots`,</br>`schedule_loaded_snapshot`|Used in the Content Scheduler block|-|
41-
|`nested_attribute`|Defines a group of attributes in a block.|`attributes` - a list of attributes in the group. The attributes in the group are [configured](#page-block-attributes) as regular attributes. </br>`multiple`, when set to true. New groups are added dynamically with the **+ Add** button.|
42+
|`nested_attribute`|Defines a group of attributes in a block.|<ul><li>`attributes` - a list of attributes in the group. The attributes in the group are [configured](#page-block-attributes) as regular attributes</li><li>`multiple`, when set to true. New groups are added dynamically with the **+ Add** button</li></ul>|
4243

4344
When you define attributes, you can omit most keys as long as you use simple types that don't require additional options:
4445

@@ -49,10 +50,9 @@ attributes:
4950
third_field: integer
5051
```
5152
52-
`embed` and `locationlist` use the Universal Discovery Widget (UDW).
53-
When creating a block with these two types you can configure the UDW behavior.
54-
55-
For more information, see [Create custom page block / Add edit template](create_custom_page_block.md#add-edit-template)
53+
The `embed`, `embedvideo`, and `locationlist` attribute types use the Universal Discovery Widget (UDW).
54+
When creating a block with these types you can use the `udw_config_name` option to configure the UDW behavior.
55+
See the [custom block example](create_custom_page_block.md#configure-block) to learn more.
5656

5757
## Custom attribute types
5858

0 commit comments

Comments
 (0)