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

Conversation

mnocon
Copy link
Contributor

@mnocon mnocon commented Apr 24, 2025

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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about removing this part:

For more information, see [Create custom page block / Add edit template](create_custom_page_block.md#add-edit-template)

Is udw_config_nameenough or are there still any "special cases" where you need to overwrite the template?

Copy link
Contributor

@vidarl vidarl Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

udw_config_name is sufficient, ie:

        banner:
            attributes:
                contentId:
                    options:
                        udw_config_name: udw_banner_config

I'm not sure about removing this part:
(....)

I think it can remain. Why remove it?

Btw, there is also a embedvideo attribute type which seems to not be mentioned in documentation. udw_config_name works for that attribute type too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reasoning was that if I can change the UDW config for the block attribute in two ways:

  • by using the udw_config_name
  • by overriding the template

And both of them achieve the same goal, but one of them is much simpler then we should recommend only the simple one.

I'd leave it only if it's like this:

  • use udw_config_name to specify the UDW config (covers 90% of the cases)
  • override the template to achieve an adidtional goal (which one? I could mention it in the custom block example )

After this discussion I've decided to double down on this and rewrote the custom block example so that it uses udw_config_name.

Btw, there is also a embedvideo attribute type which seems to not be mentioned in documentation. udw_config_name works for that attribute type too

Thanks, mentioned now!

Copy link

github-actions bot commented Apr 24, 2025

@mnocon mnocon marked this pull request as ready for review April 24, 2025 09:57
@mnocon mnocon force-pushed the IBX-8245-block-attributes-udw-config branch from efe23ee to d894809 Compare April 24, 2025 10:23
@mnocon mnocon requested a review from vidarl April 24, 2025 10:39
Copy link
Contributor

@vidarl vidarl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good beside small comment

@mnocon
Copy link
Contributor Author

mnocon commented Apr 24, 2025

Thank for you review Vidar, I've decided to partially revert changes from #2331 and show how to do this using the udw_config_name option - I will ask for your review again soon, I need to test this new procedure first.

@mnocon mnocon marked this pull request as draft April 24, 2025 14:19
Copy link

code_samples/ change report

Before (on target branch)After (in current PR)

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

docs/content_management/pages/create_custom_page_block.md@20:``` yaml

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

docs/content_management/pages/create_custom_page_block.md@20:``` yaml
docs/content_management/pages/create_custom_page_block.md@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) =]]
docs/content_management/pages/create_custom_page_block.md@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) =]]
docs/content_management/pages/create_custom_page_block.md@22:```

001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ name: Event Block
005⫶ category: Custom
006⫶ thumbnail: /bundles/ibexaicons/img/all-icons.svg#date
007⫶ attributes:
008⫶ name:
009⫶ type: text
010⫶ name: Event name
011⫶ validators:
012⫶ not_blank:
013⫶ message: Please provide a name
014⫶ category:
015⫶ type: select
016⫶ name: Select a category
017⫶ value: visual
018⫶ options:
019⫶ multiple: true
020⫶ choices:
021⫶ 'Music': music
022⫶ 'Visual arts': visual
023⫶ 'Sports': sports
024⫶ event:
025⫶ type: embed
026⫶ name: Event
docs/content_management/pages/create_custom_page_block.md@22:```

001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ name: Event Block
005⫶ category: Custom
006⫶ thumbnail: /bundles/ibexaicons/img/all-icons.svg#date
007⫶ attributes:
008⫶ name:
009⫶ type: text
010⫶ name: Event name
011⫶ validators:
012⫶ not_blank:
013⫶ message: Please provide a name
014⫶ category:
015⫶ type: select
016⫶ name: Select a category
017⫶ value: visual
018⫶ options:
019⫶ multiple: true
020⫶ choices:
021⫶ 'Music': music
022⫶ 'Visual arts': visual
023⫶ 'Sports': sports
024⫶ event:
025⫶ type: embed
026⫶ name: Event
027⫶                    validators:
028⫶ not_blank:
029⫶ message: Please select an event
030⫶ content_type:
027⫶                    options:
028⫶ udw_config_name: block_event_embed
029⫶ validators:
030⫶ not_blank:
031⫶                            message: Please select an event
031⫶                            message: Please select an event
032⫶                            options:
033⫶ types: ['event']
034⫶ regexp:
035⫶ message: Choose a content item
036⫶ options:
037⫶ pattern: '/[0-9]+/'

docs/content_management/pages/create_custom_page_block.md@45:``` yaml
docs/content_management/pages/create_custom_page_block.md@46:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 3) =]][[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 7, 16) =]]
docs/content_management/pages/create_custom_page_block.md@47:```
032⫶                        content_type:
033⫶ message: Please select an event
034⫶ options:
035⫶ types: ['event']
036⫶ regexp:
037⫶ message: Choose a content item
038⫶ options:
039⫶ pattern: '/[0-9]+/'

docs/content_management/pages/create_custom_page_block.md@41:``` yaml
docs/content_management/pages/create_custom_page_block.md@42:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 50, 59) =]]
docs/content_management/pages/create_custom_page_block.md@43:```

001⫶ibexa:
002⫶ system:
003⫶ default:
004⫶ universal_discovery_widget_module:
005⫶ configuration:
006⫶ block_event_embed:
007⫶ multiple: false
008⫶ allowed_content_types: ['event']

docs/content_management/pages/create_custom_page_block.md@54:``` yaml
docs/content_management/pages/create_custom_page_block.md@55:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 3) =]][[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 7, 16) =]]
docs/content_management/pages/create_custom_page_block.md@56:```

001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ views:
005⫶ default:
006⫶ template: '@ibexadesign/blocks/event/template.html.twig'
007⫶ name: Default view
008⫶ priority: -255
009⫶ featured:
010⫶ template: '@ibexadesign/blocks/event/featured_template.html.twig'
011⫶ name: Featured view
012⫶ priority: 50


001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ views:
005⫶ default:
006⫶ template: '@ibexadesign/blocks/event/template.html.twig'
007⫶ name: Default view
008⫶ priority: -255
009⫶ featured:
010⫶ template: '@ibexadesign/blocks/event/featured_template.html.twig'
011⫶ name: Featured view
012⫶ priority: 50

docs/content_management/pages/create_custom_page_block.md@114:``` yaml
docs/content_management/pages/create_custom_page_block.md@115:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 7) =]]
docs/content_management/pages/create_custom_page_block.md@116:```
docs/content_management/pages/create_custom_page_block.md@123:``` yaml
docs/content_management/pages/create_custom_page_block.md@124:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 7) =]]
docs/content_management/pages/create_custom_page_block.md@125:```

001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ name: Event Block
005⫶ category: Custom
006⫶ thumbnail: /bundles/ibexaicons/img/all-icons.svg#date
007⫶ configuration_template: '@ibexadesign/blocks/event/config.html.twig'


001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ name: Event Block
005⫶ category: Custom
006⫶ thumbnail: /bundles/ibexaicons/img/all-icons.svg#date
007⫶ configuration_template: '@ibexadesign/blocks/event/config.html.twig'

docs/content_management/pages/create_custom_page_block.md@128:``` yaml
docs/content_management/pages/create_custom_page_block.md@129:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 48, 57) =]]
docs/content_management/pages/create_custom_page_block.md@130:```

001⫶ibexa:
002⫶ system:
003⫶ default:
004⫶ universal_discovery_widget_module:
005⫶ configuration:
006⫶ block_event_embed:
007⫶ multiple: false
008⫶ allowed_content_types: ['event']

docs/content_management/pages/page_blocks.md@33:``` yaml
docs/content_management/pages/page_blocks.md@34:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 12) =]][[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 16, 17) =]]# ...
docs/content_management/pages/page_blocks.md@35:```

001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ name: Event Block
005⫶ category: Custom
006⫶ thumbnail: /bundles/ibexaicons/img/all-icons.svg#date
007⫶ configuration_template: '@ibexadesign/blocks/event/config.html.twig'
008⫶ views:
009⫶ default:
010⫶ template: '@ibexadesign/blocks/event/template.html.twig'
011⫶ name: Default view
012⫶ priority: -255
013⫶ attributes:
014⫶# ...

docs/content_management/pages/page_blocks.md@55:``` yaml
docs/content_management/pages/page_blocks.md@56:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 3) =]][[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 7, 16) =]]
docs/content_management/pages/page_blocks.md@57:```

001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ views:
005⫶ default:
006⫶ template: '@ibexadesign/blocks/event/template.html.twig'
007⫶ name: Default view
008⫶ priority: -255
009⫶ featured:
010⫶ template: '@ibexadesign/blocks/event/featured_template.html.twig'
011⫶ name: Featured view
012⫶ priority: 50

docs/content_management/pages/page_blocks.md@74:``` yaml
docs/content_management/pages/page_blocks.md@75:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 7) =]]
docs/content_management/pages/page_blocks.md@76:```

001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ name: Event Block
005⫶ category: Custom
006⫶ thumbnail: /bundles/ibexaicons/img/all-icons.svg#date
007⫶ configuration_template: '@ibexadesign/blocks/event/config.html.twig'


code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig

docs/content_management/pages/page_blocks.md@33:``` yaml
docs/content_management/pages/page_blocks.md@34:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 12) =]][[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 16, 17) =]]# ...
docs/content_management/pages/page_blocks.md@35:```

001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ name: Event Block
005⫶ category: Custom
006⫶ thumbnail: /bundles/ibexaicons/img/all-icons.svg#date
007⫶ configuration_template: '@ibexadesign/blocks/event/config.html.twig'
008⫶ views:
009⫶ default:
010⫶ template: '@ibexadesign/blocks/event/template.html.twig'
011⫶ name: Default view
012⫶ priority: -255
013⫶ attributes:
014⫶# ...

docs/content_management/pages/page_blocks.md@55:``` yaml
docs/content_management/pages/page_blocks.md@56:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 3) =]][[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 7, 16) =]]
docs/content_management/pages/page_blocks.md@57:```

001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ views:
005⫶ default:
006⫶ template: '@ibexadesign/blocks/event/template.html.twig'
007⫶ name: Default view
008⫶ priority: -255
009⫶ featured:
010⫶ template: '@ibexadesign/blocks/event/featured_template.html.twig'
011⫶ name: Featured view
012⫶ priority: 50

docs/content_management/pages/page_blocks.md@74:``` yaml
docs/content_management/pages/page_blocks.md@75:[[= include_file('code_samples/page/custom_page_block/config/packages/page_blocks.yaml', 0, 7) =]]
docs/content_management/pages/page_blocks.md@76:```

001⫶ibexa_fieldtype_page:
002⫶ blocks:
003⫶ event:
004⫶ name: Event Block
005⫶ category: Custom
006⫶ thumbnail: /bundles/ibexaicons/img/all-icons.svg#date
007⫶ configuration_template: '@ibexadesign/blocks/event/config.html.twig'


code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig

docs/content_management/pages/create_custom_page_block.md@120:``` html+twig
docs/content_management/pages/create_custom_page_block.md@121:[[= include_file('code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig') =]]
docs/content_management/pages/create_custom_page_block.md@122:```
docs/content_management/pages/create_custom_page_block.md@129:``` html+twig
docs/content_management/pages/create_custom_page_block.md@130:[[= include_file('code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig') =]]
docs/content_management/pages/create_custom_page_block.md@131:```

001⫶{% extends '@IbexaPageBuilder/page_builder/block/config.html.twig' %}
002⫶

001⫶{% extends '@IbexaPageBuilder/page_builder/block/config.html.twig' %}
002⫶
003⫶{% block content %}
004⫶ {% set form_templates = [_self] %}
005⫶ {{ parent() }}
006⫶{% endblock %}
007⫶
008⫶{% block basic_tab_content %}
009⫶ <div class="ibexa-block-config__fields">
010⫶ {{ form_row(form.name) }}
011⫶ {% if attributes_per_category['default'] is defined %}
012⫶ <ol>
013⫶ {% for identifier in attributes_per_category['default'] %}
014⫶ {% block config_entry %}
015⫶ <li>
016⫶ {{ form_row(form.attributes[identifier]) }}
017⫶ </li>
018⫶ {% endblock %}
019⫶ {% endfor %}
020⫶ </ol>
021⫶ {% endif %}
022⫶ </div>
023⫶{% endblock %}
024⫶
025⫶{% block block_configuration_attribute_embed_widget %}
026⫶ {% set attr = attr|merge({'hidden': true}) %}
027⫶ {{ form_widget(form, {'attr': attr})}}
028⫶ <div class="ibexa-pb-block-embed-field">
029⫶ {% include '@IbexaPageBuilder/page_builder/block/config/embed_button.html.twig' with {
030⫶ udw_config_name: 'block_event_embed',
031⫶ data_open_udw: 'data-open-udw-embed'
032⫶ } %}
033⫶ {% include '@IbexaPageBuilder/page_builder/block/config/embed_preview.html.twig' %}
034⫶ </div>
035⫶{% endblock %}
003⫶{% block basic_tab_content %}
004⫶ <div class="ibexa-block-config__fields">
005⫶ {{ form_row(form.name) }}
006⫶ {% if attributes_per_category['default'] is defined %}
007⫶ <ol>
008⫶ {% for identifier in attributes_per_category['default'] %}
009⫶ {% block config_entry %}
010⫶ <li>
011⫶ {{ form_row(form.attributes[identifier]) }}
012⫶ </li>
013⫶ {% endblock %}
014⫶ {% endfor %}
015⫶ </ol>
016⫶ {% endif %}
017⫶ </div>
018⫶{% endblock %}

docs/content_management/pages/page_blocks.md@83:``` html+twig
docs/content_management/pages/page_blocks.md@84:[[= include_file('code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig') =]]
docs/content_management/pages/page_blocks.md@85:```

001⫶{% extends '@IbexaPageBuilder/page_builder/block/config.html.twig' %}
002⫶

docs/content_management/pages/page_blocks.md@83:``` html+twig
docs/content_management/pages/page_blocks.md@84:[[= include_file('code_samples/page/custom_page_block/templates/themes/standard/blocks/event/config.html.twig') =]]
docs/content_management/pages/page_blocks.md@85:```

001⫶{% extends '@IbexaPageBuilder/page_builder/block/config.html.twig' %}
002⫶
003⫶{% block content %}
004⫶ {% set form_templates = [_self] %}
005⫶ {{ parent() }}
006⫶{% endblock %}
007⫶
008⫶{% block basic_tab_content %}
009⫶ <div class="ibexa-block-config__fields">
010⫶ {{ form_row(form.name) }}
011⫶ {% if attributes_per_category['default'] is defined %}
012⫶ <ol>
013⫶ {% for identifier in attributes_per_category['default'] %}
014⫶ {% block config_entry %}
015⫶ <li>
016⫶ {{ form_row(form.attributes[identifier]) }}
017⫶ </li>
018⫶ {% endblock %}
019⫶ {% endfor %}
020⫶ </ol>
021⫶ {% endif %}
022⫶ </div>
023⫶{% endblock %}
024⫶
025⫶{% block block_configuration_attribute_embed_widget %}
026⫶ {% set attr = attr|merge({'hidden': true}) %}
027⫶ {{ form_widget(form, {'attr': attr})}}
028⫶ <div class="ibexa-pb-block-embed-field">
029⫶ {% include '@IbexaPageBuilder/page_builder/block/config/embed_button.html.twig' with {
030⫶ udw_config_name: 'block_event_embed',
031⫶ data_open_udw: 'data-open-udw-embed'
032⫶ } %}
033⫶ {% include '@IbexaPageBuilder/page_builder/block/config/embed_preview.html.twig' %}
034⫶ </div>
035⫶{% endblock %}
003⫶{% block basic_tab_content %}
004⫶ <div class="ibexa-block-config__fields">
005⫶ {{ form_row(form.name) }}
006⫶ {% if attributes_per_category['default'] is defined %}
007⫶ <ol>
008⫶ {% for identifier in attributes_per_category['default'] %}
009⫶ {% block config_entry %}
010⫶ <li>
011⫶ {{ form_row(form.attributes[identifier]) }}
012⫶ </li>
013⫶ {% endblock %}
014⫶ {% endfor %}
015⫶ </ol>
016⫶ {% endif %}
017⫶ </div>
018⫶{% endblock %}


Download colorized diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants