diff --git a/code_samples/page/custom_page_block/config/packages/page_blocks.yaml b/code_samples/page/custom_page_block/config/packages/page_blocks.yaml index 415d06798f..383b8928e2 100644 --- a/code_samples/page/custom_page_block/config/packages/page_blocks.yaml +++ b/code_samples/page/custom_page_block/config/packages/page_blocks.yaml @@ -34,6 +34,8 @@ ibexa_fieldtype_page: event: type: embed name: Event + options: + udw_config_name: block_event_embed validators: not_blank: message: Please select an event diff --git a/code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig b/code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig index 8e82c158b3..90218036ae 100644 --- a/code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig +++ b/code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig @@ -1,10 +1,5 @@ {% extends '@IbexaPageBuilder/page_builder/block/config.html.twig' %} -{% block content %} - {% set form_templates = [_self] %} - {{ parent() }} -{% endblock %} - {% block basic_tab_content %}
{{ form_row(form.name) }} @@ -21,15 +16,3 @@ {% endif %}
{% endblock %} - -{% block block_configuration_attribute_embed_widget %} - {% set attr = attr|merge({'hidden': true}) %} - {{ form_widget(form, {'attr': attr})}} -
- {% include '@IbexaPageBuilder/page_builder/block/config/embed_button.html.twig' with { - udw_config_name: 'block_event_embed', - data_open_udw: 'data-open-udw-embed' - } %} - {% include '@IbexaPageBuilder/page_builder/block/config/embed_preview.html.twig' %} -
-{% endblock %} diff --git a/docs/content_management/pages/create_custom_page_block.md b/docs/content_management/pages/create_custom_page_block.md index 8459060974..aca93b22c3 100644 --- a/docs/content_management/pages/create_custom_page_block.md +++ b/docs/content_management/pages/create_custom_page_block.md @@ -18,7 +18,7 @@ The following example shows how to create a block that showcases an event. First, add the following [YAML configuration](configuration.md#configuration-files): ``` yaml -[[= 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) =]] +[[= 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) =]] ``` `event` is the internal name for the block, and `name` indicates the name under which the block is available in the interface. @@ -36,6 +36,15 @@ The `not_blank` validators in the example ensure that the user fills in the two The `content_type` validator in the example ensure that the user choose a content item of the content type `event`. The `regexp` validator ensure that the final value looks like a content ID. +The following UDW configuration is used with the `udw_config_name` key so only an event typed content item can be selected: + +``` yaml +[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 50, 59) =]] +``` + +For more information, see [UDW configuration](browser.md#udw-configuration). + + ## Add block templates 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//blocks/event/config.ht [[= include_file('code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig') =]] ``` -This example template overrides the `embed` attribute widget to customize the Universal Discovery Widget (UDW). -It adds itself to the `form_templates` and defines a `block_configuration_attribute_embed_widget` block. -The following UDW configuration is used so only an `event` typed content item can be selected: - -``` yaml -[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 48, 57) =]] -``` - -For more information, see [UDW configuration](browser.md#udw-configuration). - -Your custom page block is now ready. - -!!! caution - - 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). - Your custom page block is now registered in the system. !!! caution diff --git a/docs/content_management/pages/page_block_attributes.md b/docs/content_management/pages/page_block_attributes.md index bc2ef3eef3..c3d987ce3a 100644 --- a/docs/content_management/pages/page_block_attributes.md +++ b/docs/content_management/pages/page_block_attributes.md @@ -30,15 +30,16 @@ The following attribute types are available: |`url`|URL|-| |`text`|Text block|-| |`richtext`|Rich text block (see [creating RichText block](create_custom_richtext_block.md))|-| -|`embed`|Embedded content item|-| -|`select`|Drop-down with options to select|`choices` lists the available options in `label: value` form
`multiple`, when set to true, allows selecting more than one option. +|`embed`|Embedded content item|`udw_config_name`: name of the [Universal Discovery Widget's configuration](browser.md#add-new-configuration) | +|`embedvideo`|Embedded content item|`udw_config_name`: name of the [Universal Discovery Widget's configuration](browser.md#add-new-configuration) | +|`select`|Drop-down with options to select|| |`checkbox`|Checkbox|Selects available option if `value: true`.| |`multiple`|Checkbox(es)|`choices` lists the available options in `label: value` form.| |`radio`|Radio buttons|`choices` lists the available options in `label: value` form.| -|`locationlist`|Location selection|-| +|`locationlist`|Location selection| `udw_config_name`: name of the [Universal Discovery Widget's configuration](browser.md#add-new-configuration) | |`contenttypelist`|List of content types|-| |`schedule_events`,
`schedule_snapshots`,
`schedule_initial_items`,
`schedule_slots`,
`schedule_loaded_snapshot`|Used in the Content Scheduler block|-| -|`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.
`multiple`, when set to true. New groups are added dynamically with the **+ Add** button.| +|`nested_attribute`|Defines a group of attributes in a block.|| When you define attributes, you can omit most keys as long as you use simple types that don't require additional options: @@ -49,10 +50,9 @@ attributes: third_field: integer ``` -`embed` and `locationlist` use the Universal Discovery Widget (UDW). -When creating a block with these two types you can configure the UDW behavior. - -For more information, see [Create custom page block / Add edit template](create_custom_page_block.md#add-edit-template) +The `embed`, `embedvideo`, and `locationlist` attribute types use the Universal Discovery Widget (UDW). +When creating a block with these types you can use the `udw_config_name` option to configure the UDW behavior. +See the [custom block example](create_custom_page_block.md#configure-block) to learn more. ## Custom attribute types