Issue #3340217 by vnech: "Dropdown" render element doesn't set non-existent option as "active" #3307
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
If add any new group content visibility option to the flexible group (/admin/group/types/manage/flexible_group/fields/group.flexible_group.field_group_allowed_visibility/storage)
![alt](https://camo.githubusercontent.com/6e4696a08bb9ad2a7cfe3e58295f0c3eb78acec7baefc4da414d2ad3177ebf82/68747470733a2f2f7777772e64727570616c2e6f72672f66696c65732f6973737565732f323032332d30322d30382f53637265656e73686f74253230323032332d30322d3038253230617425323031322e34332e33372e706e67)
enable "Enable posts for members" and choose only this option in "Group content visibility options" field due creating a group
![alt](https://camo.githubusercontent.com/d186ecd2a47db2abf6110a921b5113d30eb556510b33b2c4192c4b1278654f40/68747470733a2f2f7777772e64727570616c2e6f72672f66696c65732f6973737565732f323032332d30322d30382f53637265656e73686f74253230323032332d30322d3038253230617425323031322e34352e31382e706e67)
we get fatal error on group stream:
The website encountered an unexpected error. Please try again later.
TypeError: _socialbase_get_visibility_icon(): Argument #1 ($title) must be of type string, null given, called in /var/www/html/html/themes/contrib/socialbase/src/Plugin/Preprocess/FieldDropdown.php on line 24 in _socialbase_get_visibility_icon() (line 80 of themes/contrib/socialbase/socialbase.theme).
_socialbase_get_visibility_icon(NULL) (Line: 24)
Drupal\socialbase\Plugin\Preprocess\FieldDropdown->preprocess(Array, 'dropdown', Array) (Line: 1443)
Drupal\bootstrap\Bootstrap::preprocess(Array, 'dropdown', Array) (Line: 118)
bootstrap_preprocess(Array, 'dropdown', Array)
call_user_func_array('bootstrap_preprocess', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('dropdown', Array) (Line: 478)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 75)
__TwigTemplate_eb9ba40db22317197998c9eb3d0c03becd2232b767050d8a7e8d8c3b492eb7bb->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/contrib/bootstrap/templates/field/field-multiple-value-form.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('field_multiple_value_form', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 56)
__TwigTemplate_4bd2fc9abe6f1201de01478feea0f592aec76b21ad47a86c81a3e344ce3087eb->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/contrib/socialbase/templates/block/block--social-post.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('block', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 201)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 157)
Drupal\Core\Render\Renderer->Drupal\Core\Render{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 158)
Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 172)
Drupal\Core\Render\Renderer->renderPlaceholder('callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder&args%5B0%5D=postongroupblock&args%5B1%5D=default&args%5B2%5D&token=8ZSByMIrBTb3TyShsmie_pkvhoMwGaxi1gERGHbmvSU', Array) (Line: 693)
Drupal\big_pipe\Render\BigPipe->renderPlaceholder('callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder&args%5B0%5D=postongroupblock&args%5B1%5D=default&args%5B2%5D&token=8ZSByMIrBTb3TyShsmie_pkvhoMwGaxi1gERGHbmvSU', Array) (Line: 547)
Drupal\big_pipe\Render\BigPipe->sendPlaceholders(Array, Array, Object) (Line: 305)
Drupal\big_pipe\Render\BigPipe->sendContent(Object) (Line: 112)
Drupal\big_pipe\Render\BigPipeResponse->sendContent() (Line: 381)
Symfony\Component\HttpFoundation\Response->send() (Line: 20)
Solution
"Dropdown" render element should not set non-existent option as "active"
Issue tracker
Theme issue tracker
n/a
How to test
Definition of done
Before merge
After merge
Screenshots
n/a
Release notes
"Dropdown" render element doesn't set non-existent option as "active"
Change Record
n/a
Translations
n/a