- Issue created by @almunnings
- First commit to issue fork.
- Merge request !43multiselect_dropdown-3492120/3492120-modalbreakpoint-uses-enum: Made option to... → (Open) created by sourabhsisodia_
- 🇮🇳India divyansh.gupta Jaipur
I have reviewed this issue and the MR is fixing the issue
Before:
After:
But Tests and PHPCS are failing in the pipeline, so i think tests needs to be updated and PHPCS errors must be solved thus moving this issue to NW.
- 🇳🇱Netherlands megachriz
After installing the patch I get the following error:
ValueError: Value "breakpoint" of "#modal_type" is not allowed in multiselect dropdown "edit-rie". in template_preprocess_multiselect_dropdown() (line 159 of modules/contrib/multiselect_dropdown/multiselect_dropdown.module).
call_user_func_array('template_preprocess_multiselect_dropdown', Array) (Line: 261)
Drupal\Core\Theme\ThemeManager->render('multiselect_dropdown', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)The form element is used in custom code and looks like this:
$form['fieldset_filter']['rie'] = [ '#type' => 'multiselect_dropdown', '#title' => $this->t('Select'), // '#default_value' => $this->getSelectedOptions($items), '#options' => $rie_options, '#label_aria' => 'Toggle the list of items', '#label_none' => 'No RIE\'s selected', '#label_all' => 'All RIE\'s selected', '#label_single' => '%d RIE selected', '#label_plural' => '%d RIE\'s selected', '#modal_breakpoint' => ModalType::Modal->value, '#ajax' => [ 'callback' => '::getRieModulesAjax', 'disable-refocus' => FALSE, 'event' => 'change', 'progress' => [ 'type' => 'throbber', 'message' => $this->t('Fetch modules..'), ], 'wrapper' => 'rieriemodules', ], ];
If I replace
'#modal_breakpoint' => ModalType::Modal->value,
with'#modal_type' => ModalType::Breakpoint->value,
in the custom code, then the error is resolved and the dropdown renders as desired.Based on my findings above, it looks to me that requiring "#modal_type" is an API change. I don't know enough about the module whether or not that is a desired adjustment. But if it is, it needs at least be documented in
\Drupal\multiselect_dropdown\Element\MultiselectDropdown
. In the docblock there is a code example where#modal_breakpoint
is used instead of#modal_type
.But I do wonder if requiring "#modal_type" is correct here as it apparently can break other modules that are not using the widget, but just the "multiselect_dropdown" form element.
- Status changed to Needs work
about 1 month ago 7:20pm 20 February 2025 - 🇺🇸United States benabaird
benabaird → changed the visibility of the branch 3492120-modalbreakpoint-uses-enum to hidden.
- 🇺🇸United States benabaird
benabaird → changed the visibility of the branch 3492120-modalbreakpoint-uses-enum to active.
- 🇺🇸United States benabaird
This issue was caused by the fix in Modal/Dialog type behaviors are reversed in JavaScript 🐛 Modal/Dialog type behaviors are reversed in JavaScript Active not updating the field widget. Updated the field widget and added a test to check this.
At this point I don't think we want to add the configuration option added in https://git.drupalcode.org/issue/multiselect_dropdown-3492120/-/tree/3492120-modalbreakpoint-uses-enum, and instead always display it as a dropdown on edit forms as was the original intent.
-
benabaird →
committed 9acf30a5 on 1.2.x
Issue #3492120 by benabaird, almunnings: #modal_breakpoint uses enum...
-
benabaird →
committed 9acf30a5 on 1.2.x
- 🇨🇦Canada peterhebert
Issue doesn't appear to be fixed - I updated to the 1.2.3 release that included the issue. I tried all of the widget settings (breakpoint, dialog, and modal) - and all of them result on an absolutely positioned modal dialog on mobile that cannot be closed via UI or escape key.
Automatically closed - issue fixed for 2 weeks with no activity.