From d8948096d669cae6483576845d48fbc45d72ac43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 24 Apr 2025 11:51:00 +0200 Subject: [PATCH 1/3] Added documentation for udw_config_name --- .../pages/page_block_attributes.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/content_management/pages/page_block_attributes.md b/docs/content_management/pages/page_block_attributes.md index bc2ef3eef3..62b01cb80c 100644 --- a/docs/content_management/pages/page_block_attributes.md +++ b/docs/content_management/pages/page_block_attributes.md @@ -30,15 +30,15 @@ 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) | +|`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: @@ -50,9 +50,7 @@ attributes: ``` `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) +When creating a block with these two types you can use the `udw_config_name` option to configure the UDW behavior. ## Custom attribute types From cdcc26961b036d35b4b153a6f581291ad06dd3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 24 Apr 2025 15:42:32 +0200 Subject: [PATCH 2/3] Removed conflict resolution leftover --- docs/content_management/pages/create_custom_page_block.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/content_management/pages/create_custom_page_block.md b/docs/content_management/pages/create_custom_page_block.md index 8459060974..2872afcbf2 100644 --- a/docs/content_management/pages/create_custom_page_block.md +++ b/docs/content_management/pages/create_custom_page_block.md @@ -131,12 +131,6 @@ The following UDW configuration is used so only an `event` typed content item ca 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 From 57cfa8aba86273f63a6e97221f71c040bd7983db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 24 Apr 2025 16:16:09 +0200 Subject: [PATCH 3/3] Refactored the custom block example, added embedvideo --- .../config/packages/page_blocks.yaml | 2 ++ .../standard/blocks/event/config.html.twig | 17 --------------- .../pages/create_custom_page_block.md | 21 +++++++++---------- .../pages/page_block_attributes.md | 6 ++++-- 4 files changed, 16 insertions(+), 30 deletions(-) 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 2872afcbf2..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,16 +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 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 62b01cb80c..c3d987ce3a 100644 --- a/docs/content_management/pages/page_block_attributes.md +++ b/docs/content_management/pages/page_block_attributes.md @@ -31,6 +31,7 @@ The following attribute types are available: |`text`|Text block|-| |`richtext`|Rich text block (see [creating RichText block](create_custom_richtext_block.md))|-| |`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|
  • `choices` lists the available options in `label: value` form
  • `multiple`, when set to true, allows selecting more than one option
| |`checkbox`|Checkbox|Selects available option if `value: true`.| |`multiple`|Checkbox(es)|`choices` lists the available options in `label: value` form.| @@ -49,8 +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 use the `udw_config_name` option to configure the UDW behavior. +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