- Issue created by @Grimreaper
- 🇫🇷France pdureau Paris
- with an override of the paragraph default twig template to remove the wrapper div, then it is ok.
Instead of just removing the wrapper, I would do something like that for paragraph.html.twig:
{% if attributes %} <div{{ attributes.addClass(classes) }}> {% endif %} {{ content }} {% if attributes %} </div> {% endif %}
or into a ui_patterns_entity_status or another name?
In order to keep the
not paragraph.isPublished() ? 'paragraph--unpublished'
feature, we can dream about a ui_styles ecosystem module allowing the addition of a style for each Drupal\workflows\State of a Drupal\workflows\WorkflowInterface:id: editorial label: Editorial type: content_moderation type_settings: states: archived: label: Archived weight: 5 published: false default_revision: true ui_styles: - bg-color-secondary draft: label: Draft published: false default_revision: false weight: -5 ui_styles: - border-warning
- 🇫🇷France Grimreaper France 🇫🇷
Thanks for the reply.
Point 1: wrapper div
The if statement is always true so not possible. Or we need to think about a configuration to be able to tell, in this view mode (of this bundle of the content entity) remove the wrapper, so we can have a Twig variable to base the if statement on.
Point 2: adding CSS class
Nice idea that this will be more in UI Styles side than UI Patterns!
Regarding our quick call.
1: let's do workflow integration in a second time
2: Using hook_entity_view is ok. quick poc:/** @var \Drupal\ui_styles\StylePluginManagerInterface $styles_manager */ $styles_manager = \Drupal::service('plugin.manager.ui_styles'); if (isset($build['_layout_builder'][0])) { $build['_layout_builder'][0] = $styles_manager->addClasses($build['_layout_builder'][0], ['bg-danger-subtle']); }
Need to be cleaned up to loop and to handle non layout builder handled view mode. Like ui_styles_layout_builder does.
About the workflow integration, we need to chack if third_party_settings are handled, ok. But for the default boolean status on entities, where should we store the ui styles plugin classes we want to use?
- a global configuration form?
- in theme settings?
- somewhere else?Maybe let's create an issue in UI Styles to continue this conversation, or use this one?
And in UI Suite Bootstrap we can have an issue about removing paragraphs wrapper and an issue about updating how the unpublished class is working regarding the new ui_styles module. - Assigned to Grimreaper
- Merge request !155Issue #3399450 by Grimreaper, pdureau: Entity wrapper prevents site building... → (Merged) created by Grimreaper
- Status changed to Needs work
11 months ago 4:09pm 14 December 2023 - 🇫🇷France Grimreaper France 🇫🇷
I don't know if we should add a dependency on ui_styles_entity_status and provide a default configuration in the theme settings.
- 🇫🇷France Grimreaper France 🇫🇷
The removing of the div wrapper in paragraph.html.twig will prevent ui_styles_paragraphs to work with ui_suite_bootstrap.
- 🇫🇷France Grimreaper France 🇫🇷
New module for that: https://www.drupal.org/project/entity_vdts →
-
Grimreaper →
committed b00c318f on 5.0.x
Issue #3399450 by Grimreaper, pdureau: Entity wrapper prevents site...
-
Grimreaper →
committed b00c318f on 5.0.x
- Issue was unassigned.
- Status changed to Fixed
11 months ago 5:25pm 21 December 2023 - 🇫🇷France Grimreaper France 🇫🇷
UI Patterns best practice documentation page updated too.
Automatically closed - issue fixed for 2 weeks with no activity.