- 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
4 days ago 7:20pm 20 February 2025