- Issue created by @pdureau
- 🇫🇷France pdureau Paris
Entity Field Source Plugin (for slots): Pick and configure a block from all field specific to the entity related to the display we are currently editing. Form : select the field, a formatter and configure the formatter.
This look like a generalization of the
FieldFormatter
source fromui_pattrns_field_formatters
where the context is the (entity type, field) tuple (we cannot select something outside of the field we are currently working on):, and the configuration is the selected formatter configuration formAn other issue is dealing with the generalization of an
ui_pattrns_field_formatters
source plugin: ✨ [2.0.0-alpha3] Add allow_expose source plugin Active - First commit to issue fork.
- Assigned to just_like_good_vibes
- 🇩🇪Germany Christian.wiedemann
This can easily done with the refactoring of the forms. We can use slot form widget inside a block and we are done. Should I take it?
- Issue was unassigned.
- Assigned to Christian.wiedemann
- Status changed to Needs work
5 months ago 8:46pm 19 June 2024 - 🇫🇷France just_like_good_vibes PARIS
An we exchanged during the weekly, let's remark the following thing in the current 2.0.x codebase.
when we treated the issue 3444716 ✨ [2.0.0-alpha3] Add block source (for slots) Fixed ,
we declared a new consumer "ui_patterns" for block discovery and filtering.
As seen in Drupal\ui_patterns\Plugin\UiPatterns\Source::listBlockDefinitions,
we are calling plugin.manager.block:getFilteredDefinitions with ui_patterns as the first argument.
(see Drupal\Core\Plugin\FilteredPluginManagerTrait::getFilteredDefinitions).
this implies, some alter hooks are called during plugin discovery "plugin_filter_{$type}" and "plugin_filter_{$type}__{$consumer}".We proposed a first implementation of those hooks in ui_patterns.module, and this may not be perfect right now,
and has to refined maybe in this issue.see functions "ui_patterns_plugin_filter_block__ui_patterns_alter" and "ui_patterns_plugin_filter_block_alter" in ui_patterns.module
- Issue was unassigned.
- Assigned to just_like_good_vibes
- 🇫🇷France just_like_good_vibes PARIS
thanks christian, to parallelize last alpha3 efforts, i re-take it :)
- 🇫🇷France pdureau Paris
Entity Link Label Source Plugin (for strings): Select the entity link among $entity_type->getLinkTemplates()
Removed from scope
- Status changed to Needs review
5 months ago 4:40pm 25 June 2024 - Assigned to pdureau
- Assigned to just_like_good_vibes
- 🇫🇷France just_like_good_vibes PARIS
Hello,
what a mess...To summarize :
- playing with contexts, i found several bugs in our implementation, which i corrected.
- i refactored a little bit how injection was done with source plugins, was quite strange. some source plugin constructors have thus changed
- i added some services to source plugin base
- LB field blocks are quite singular, but they are available
- entity link urls are availableMain drawback :
the current implementation does not allow some scenarios in Layout Builder.
Especially, we have quite a problem when we use "ComponentBlock" Block plugin, because at rendering they can't get the real entity renderer from the context. thus, the entity cannot be passed to source plugins. so as soon as there is a ComponentBlock in LB, any source which needs in its context the entity being rendered by LB won't work.
to allow "ComponentBlock" block plugins to "receive" in their contexts the LB entity rendered, we need an "entity" content definition for the block plugin plus a context_mapping from layout_builder.entity. And it is difficult to do that, because those two things are not always needed, or it would break "ComponentBlock" blocks from rendering if they are rendered elsewhere without any entity...
very difficult problem. still WIP for me.
maybe we can merge this implementation and postpone this very special case of LB + ComponentBlock entity contexts? - 🇫🇷France just_like_good_vibes PARIS
and also... when testing, be careful with an existing site configuration.
when you install layout_builder now, it will automatically enables "layout_builder_expose_all_field_blocks" sub-module.
please be sure to have a fresh installs, run "drush updb" or manually check this submodule is enabled.
it is required to allow LB field blocks to show in UI patterns block selection. - Status changed to Needs work
5 months ago 12:18pm 26 June 2024 - 🇫🇷France pdureau Paris
KO
Formatter in Manage display:
- Block with context? (without expose_all_field_blocks module) >> Not in selector
- Entity link? >> OK
Block in Layout Builder
- Block with context? (without expose_all_field_blocks module) >> Visible in selector, but "Uncaught PHP Exception LogicException: "TODO: entity is missing from the context" at src/Plugin/UiPatterns/Source/BlockSource.php line 257"
- Entity link? >> Visible in selector, but "count(): Argument #1 ($value) must be of type Countable|array, null given" at src/Element/ComponentElementBuilder.php
Formatter in Layout Builder:
- Block with context? (without expose_all_field_blocks module) >> Visible in selector, but silent error when I chose a formatter for the embeded field block: the component form is reinitializing
- Entity link? >> OK
Also, I have this issue when I chose a link which is not allowed:
Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "entity.node.create" does not exist." at /core/lib/Drupal/Core/Routing/RouteProvider.php line 208"
- Status changed to Needs review
5 months ago 3:30pm 26 June 2024 - 🇫🇷France just_like_good_vibes PARIS
i have pushed somes updates :
In UI Patterns Blocks
- now we have two families of block plugins :
- the ones that are specific for layout builder, should not appear anywhere else. They have a context_definitions with an entity and a context_mapping for layout builder.
- the ones that are used elsewhere (block layout page, in the select list of block source plugin..), they should not appear in layout builder.- playing with contexts, i found bugs in our implementations, which i corrected. See for example 3 lines removed in SourcePluginBase class.
also the function getComponentSourceContexts in field formatters (see ComponentFormatterBase, ComponentPerItemFormatter, ComponentFormatter.php
- i refactored a little bit how injection was done with source plugins, its was quite strange (i added some services to source plugin base). Some source plugin constructors have thus changed. it has trigger changes in sources from UI patterns and UI patterns field formatters : FieldFormatterSource, BlockSource, BreadcrumbSource, FieldPropertySourceBase, FieldSourceBase,- some blocks provided by layout builder are not appearing in the "Block source" select list : the blocks that have required contexts (in context_definitions) other than "entity". see ui_patterns.module changes
- 🇫🇷France just_like_good_vibes PARIS
changes component to "code", as it also includes some changes in the main module and in the field formatters module
- Assigned to pdureau
- 🇫🇷France just_like_good_vibes PARIS
unfortunately,context mapping and reloading mapped entity does not work good in Layout builder.
for example, add a ui patterns block in LB, in a slot or a prop, use the source Entity link URL.
the block has a bonus select at the bottom, to select the mapped entity.
the loading/reloading does not working well yet. - Status changed to Needs work
5 months ago 10:34am 27 June 2024 - 🇫🇷France just_like_good_vibes PARIS
i need to correct a few things.. you can still review it in its actual state.
- Status changed to Needs review
5 months ago 12:42pm 27 June 2024 - 🇫🇷France just_like_good_vibes PARIS
ok, i pushed many fixes. should be really better
-
pdureau →
committed 31b93bd0 on 2.0.x authored by
just_like_good_vibes →
Issue #3444768 by just_like_good_vibes, pdureau, Christian.wiedemann:...
-
pdureau →
committed 31b93bd0 on 2.0.x authored by
just_like_good_vibes →
- Issue was unassigned.
- Status changed to Fixed
5 months ago 3:52pm 27 June 2024 - Status changed to Fixed
5 months ago 1:44pm 3 July 2024