- π©πͺGermany Anybody Porta Westfalica
Totally agree this would still make sense to make this alterable. Or are there any other ways to hook into this form cleanly?
- πΊπΈUnited States kevinquillen
This is really needed in cases where users select from menu_blocks as options only. Instead, they get two sets of blocks defined by both the system and menu_block modules, where I only want menu_block (because this presents the extra features of that module).
- πΊπΈUnited States kevinquillen
To get around this in my case, I extended the field widget until there is another solution.
/** * Plugin implementation of the 'block_field' widget. * * @FieldWidget( * id = "mymodule_block_field", * label = @Translation("Block field (for menus)"), * field_types = { * "block_field" * } * ) */ class BlockFieldWidget extends BaseBlockFieldWidget { /** * {@inheritdoc} */ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $element = parent::formElement($items, $delta, $element, $form, $form_state); if (!empty($element["plugin_id"]["#options"]["Menus"])) { $options = $element["plugin_id"]["#options"]["Menus"]; $element["plugin_id"]["#options"]["Menus"] = array_filter($options, fn ($option) => !str_contains($option, 'system_'), ARRAY_FILTER_USE_KEY); } return $element; } }
- πΊπ¦Ukraine vlad.dancer Kyiv
vlad.dancer β made their first commit to this issueβs fork.
- Merge request !16Draft: Issue #2985602 - add basic support for block modules based on block entity β (Open) created by vlad.dancer
- Status changed to Needs review
7 months ago 6:16pm 19 May 2024