The list of available options for adding fields is only updated when adding composite fields not when deleting

Created on 21 April 2024, over 1 year ago

Problem/Motivation

If you are deleting a composite field and add a composite field on a content type the previously deleted composite field is still shown in the list of available options

Steps to reproduce

  • create /web/modules/custom/field_union
  • git clone git@git.drupal.org:issue/field_union-3011353.git .
  • git checkout field_union-3011353
  • ddev drush en field_union
  • Create a composite field called one on /admin/structure/field-union/add with just one plain text field
  • Crete a second composite field called two on /admin/structure/field-union/add with just one plain text field
  • Create a content type composite , delete the body field, and create a new field, choose the composite field, and you will see the options one and two.
  • dont finish the creation of the new field instead go back to /admin/structure/field-union and delete one and two
  • go back to /admin/structure/types/manage/composite/fields, create a new field, choose the composite /field union,

=> you will notice the deleted options are still shown

  • instead of saving the new field instead go to /admin/structure/field-union/add and create a composite named three with a plain text field
  • go back to /admin/structure/types/manage/composite/fields, create a new field, choose the composite /field union,

=> the only option shown is three

and if you delete the composite three on /admin/structure/field-union and then go back to /admin/structure/types/manage/composite/fields and create a new field and you add a composite field and pick three and go ahead this time the WSOD looks like this:

The website encountered an unexpected error. Try again later.

AssertionError: assert($union instanceof FieldUnionInterface) in assert() (line 183 of modules/custom/field_union/src/Plugin/Field/FieldType/FieldUnion.php).
Drupal\field_union\Plugin\Field\FieldType\FieldUnion::getFieldUnionEntityFromFieldDefinition() (Line: 39)
Drupal\field_union\Plugin\Field\FieldType\FieldUnion::propertyDefinitions() (Line: 794)
Drupal\field\Entity\FieldStorageConfig->getPropertyDefinitions() (Line: 65)
Drupal\Core\Field\TypedData\FieldItemDataDefinition->getPropertyDefinitions() (Line: 64)
Drupal\Core\Field\FieldItemBase->__construct() (Line: 47)
Drupal\Core\TypedData\TypedData::createInstance() (Line: 99)
Drupal\Core\TypedData\TypedDataManager->createInstance() (Line: 108)
Drupal\Core\TypedData\TypedDataManager->create() (Line: 208)
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance() (Line: 91)
Drupal\Core\Field\FieldTypePluginManager->createFieldItem() (Line: 41)
Drupal\Core\Field\FieldItemList->createItem() (Line: 210)
Drupal\Core\TypedData\Plugin\DataType\ItemList->appendItem() (Line: 122)
Drupal\field_ui\Form\FieldStorageConfigEditForm->form() (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm() (Line: 85)
Drupal\field_ui\Form\FieldStorageConfigEditForm->buildForm() (Line: 199)
Drupal\field_ui\Form\FieldConfigEditForm->form() (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm()
call_user_func_array() (Line: 528)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 279)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm() (Line: 62)
Drupal\field_ui\Controller\FieldConfigAddController->fieldConfigAddConfigureForm()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 637)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 178)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 705)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Component

User interface

Created by

🇩🇪Germany rkoller Nürnberg, Germany

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024