Module breaks creation of new fields

Created on 11 November 2024, 8 months ago

Problem/Motivation

With this module installed, I cannot add new fields to either Node or Taxonomy term entities with Drupal UI.

I have Drupal Core 10.3.6 installed with 1.0.0 version of required_by_form_mode.

Idk if that relevant, but see attached screenshot about how tooltip looks like on edit form of new field:

Couple of log message I receive per field save:

#0 /app/web/core/modules/field/src/Entity/FieldStorageConfig.php(335): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\field\FieldStorageConfigStorage))
#1 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(528): Drupal\field\Entity\FieldStorageConfig->preSave(Object(Drupal\field\FieldStorageConfigStorage))
#2 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(483): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\field\Entity\FieldStorageConfig))
#3 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(257): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\field\Entity\FieldStorageConfig))
#4 /app/web/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\field\Entity\FieldStorageConfig))
#5 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(614): Drupal\Core\Entity\EntityBase->save()
#6 /app/web/modules/contrib/required_by_form_mode/required_by_form_mode.module(124): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#7 [internal function]: required_by_form_mode_field_config_edit_form_builder('field_config', Object(Drupal\field\Entity\FieldConfig), Array, Object(Drupal\Core\Form\FormState))
#8 /app/web/core/lib/Drupal/Core/Entity/EntityForm.php(307): call_user_func_array('required_by_for...', Array)
#9 /app/web/core/modules/field_ui/src/Form/FieldConfigEditForm.php(374): Drupal\Core\Entity\EntityForm->buildEntity(Array, Object(Drupal\Core\Form\FormState))
#10 [internal function]: Drupal\field_ui\Form\FieldConfigEditForm->validateForm(Array, Object(Drupal\Core\Form\FormState))
#11 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array(Array, Array)
#12 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(274): Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object(Drupal\Core\Form\FormState))
#13 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'field_config_ed...')
#14 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(593): Drupal\Core\Form\FormValidator->validateForm('field_config_ed...', Array, Object(Drupal\Core\Form\FormState))
#15 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm('field_config_ed...', Array, Object(Drupal\Core\Form\FormState))
#16 /app/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\field_ui\Form\FieldConfigEditForm), Object(Drupal\Core\Form\FormState))
#17 /app/web/core/modules/field_ui/src/Controller/FieldConfigAddController.php(63): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\field\Entity\FieldConfig), 'default', Array)
#18 [internal function]: Drupal\field_ui\Controller\FieldConfigAddController->fieldConfigAddConfigureForm('node', 'field_test4')
#19 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#20 /app/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#22 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#23 /app/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#24 /app/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#25 /app/web/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(68): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /app/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /app/vendor/asm89/stack-cors/src/Cors.php(53): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /app/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /app/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 /app/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#38 {main}
Deprecated function: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Config\Entity\Query\Condition->compile() (regel 39 van /app/web/core/lib/Drupal/Core/Config/Entity/Query/Condition.php)
#0 /app/web/core/includes/bootstrap.inc(166): _drupal_error_handler_real(8192, 'mb_strtolower()...', '/app/web/core/l...', 39)
#1 [internal function]: _drupal_error_handler(8192, 'mb_strtolower()...', '/app/web/core/l...', 39)
#2 /app/web/core/lib/Drupal/Core/Config/Entity/Query/Condition.php(39): mb_strtolower(NULL)
#3 /app/web/core/lib/Drupal/Core/Config/Entity/Query/Query.php(88): Drupal\Core\Config\Entity\Query\Condition->compile(Array)
#4 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(307): Drupal\Core\Config\Entity\Query\Query->execute()
#5 /app/web/core/modules/field/src/Entity/FieldStorageConfig.php(335): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\field\FieldStorageConfigStorage))
#6 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(528): Drupal\field\Entity\FieldStorageConfig->preSave(Object(Drupal\field\FieldStorageConfigStorage))
#7 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(483): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\field\Entity\FieldStorageConfig))
#8 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(257): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\field\Entity\FieldStorageConfig))
#9 /app/web/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\field\Entity\FieldStorageConfig))
#10 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(614): Drupal\Core\Entity\EntityBase->save()
#11 /app/web/modules/contrib/required_by_form_mode/required_by_form_mode.module(123): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#12 [internal function]: required_by_form_mode_field_config_edit_form_builder('field_config', Object(Drupal\field\Entity\FieldConfig), Array, Object(Drupal\Core\Form\FormState))
#13 /app/web/core/lib/Drupal/Core/Entity/EntityForm.php(307): call_user_func_array('required_by_for...', Array)
#14 /app/web/core/modules/field_ui/src/Form/FieldConfigEditForm.php(374): Drupal\Core\Entity\EntityForm->buildEntity(Array, Object(Drupal\Core\Form\FormState))
#15 [internal function]: Drupal\field_ui\Form\FieldConfigEditForm->validateForm(Array, Object(Drupal\Core\Form\FormState))
#16 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array(Array, Array)
#17 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(274): Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object(Drupal\Core\Form\FormState))
#18 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'field_config_ed...')
#19 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(593): Drupal\Core\Form\FormValidator->validateForm('field_config_ed...', Array, Object(Drupal\Core\Form\FormState))
#20 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm('field_config_ed...', Array, Object(Drupal\Core\Form\FormState))
#21 /app/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\field_ui\Form\FieldConfigEditForm), Object(Drupal\Core\Form\FormState))
#22 /app/web/core/modules/field_ui/src/Controller/FieldConfigAddController.php(63): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\field\Entity\FieldConfig), 'default', Array)
#23 [internal function]: Drupal\field_ui\Controller\FieldConfigAddController->fieldConfigAddConfigureForm('node', 'field_test')
#24 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#25 /app/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#26 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#27 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#28 /app/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#29 /app/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#30 /app/web/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(68): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /app/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 /app/vendor/asm89/stack-cors/src/Cors.php(53): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#38 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#39 /app/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#40 /app/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#41 /app/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#42 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#43 {main}

Steps to reproduce

  1. Go to some entities' field list (for Nodes: /admin/structure/types/manage/[node_type]/fields)
  2. Click on button above to add new field
  3. Go thru all steps of new field configuration, end on Field settings edit form (/admin/structure/types/manage/[node_type]/add-field/node/[new_field_id], for example)
  4. Try to save new field by clicking Submit after filling in the form

Proposed resolution

I don't have enough time to properly test and understand what happening and how it need to be solved correctly, but I was able to avoid described error with just checking value to be added as third-party setting within required_by_form_mode_field_config_edit_form_builder().
See patch I will attach for solution that helped me.

Also I'll set priority to Critical as this bug breaks one of core functionalities.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡ΎBelarus aylis

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024