Skip to content

Added documentation for udw_config_name #2719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{% extends '@IbexaPageBuilder/page_builder/block/config.html.twig' %}

{% block content %}
{% set form_templates = [_self] %}
{{ parent() }}
{% endblock %}

{% block basic_tab_content %}
<div class="ibexa-block-config__fields">
{{ form_row(form.name) }}
Expand All @@ -21,15 +16,3 @@
{% endif %}
</div>
{% endblock %}

{% block block_configuration_attribute_embed_widget %}
{% set attr = attr|merge({'hidden': true}) %}
{{ form_widget(form, {'attr': attr})}}
<div class="ibexa-pb-block-embed-field">
{% 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' %}
</div>
{% endblock %}
27 changes: 10 additions & 17 deletions docs/content_management/pages/create_custom_page_block.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -121,22 +130,6 @@ Place the edit template in `templates/themes/<your_theme>/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
Expand Down
16 changes: 8 additions & 8 deletions docs/content_management/pages/page_block_attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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</br>`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|<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>|
|`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`,</br>`schedule_snapshots`,</br>`schedule_initial_items`,</br>`schedule_slots`,</br>`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. </br>`multiple`, when set to true. New groups are added dynamically with the **+ Add** button.|
|`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>|

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

Expand All @@ -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

Expand Down
Loading