Using store engine fields with Profile module and inline forms is problematic

Created on 31 January 2024, 5 months ago
Updated 14 March 2024, 4 months ago

Problem/Motivation

Please visit this issue to get an idea: https://www.drupal.org/project/profile/issues/3418357 πŸ› Saving of profile not possible if storage engine fields are present Active

I'll re-write what causes problems here in short:

I use Profiles. One Profile has a field named field_family_members which is NOT required and can have unlimited values. This field is a reference to a storage entity with 4 fields which all ARE required - usually. I made all these 4 fields NOT required for my test.

In the user settings I set the profile so, that it uses "Complex Forms", thus the form is presented by click on a button. Now comes the problem: Even though every field in the storage entity is NOT required, the name of the storage entity still is. If I leave everything empty I have to name the family member. If I use the name "Test" the storage engine will complain that it cannot be saved or so (see attachment).

Because Drupals UI do not allow NO ROWS for a unlimited inline form entity. I cannot save the profile with that setup.

At this point I have no idea if the Profile module or the Storage modul is in charge here. Thats why I made a issue here and there.

πŸ› Bug report
Status

Closed: outdated

Version

1.3

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany ro-no-lo

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

Comments & Activities

  • Issue created by @ro-no-lo
  • πŸ‡©πŸ‡ͺGermany ro-no-lo

    There seems to be a deeper problem involved here. Because after updating to D10 I cannot save even entities with referenced storage engine items anymore. It just complains. See screenshot.

  • πŸ‡©πŸ‡ͺGermany ro-no-lo

    I have no idea why only me has this problem. But something is messed up and I expect the ValidReferenceConstraintValidator.php be part of the problem. I CAN create a storage_data entity, BUT I cannot reference it in another entity. The Validator messes up the valid_entity_ids with the invalid IDs and thus it complains all day long.

  • πŸ‡©πŸ‡ͺGermany ro-no-lo

    I checked my other entities which reference to storage_data fields. And ALL have somewhat broken references.

    It seems that something at some magic place went wrong, because when I create a second field which references to the same storage_data entities it works finde.

    I now have to find a way to fix everything without loosing data.

    Btw. no pending update db or entities updates are in queue. Everything is uptodate.

  • πŸ‡©πŸ‡ͺGermany ro-no-lo

    Just as a note. If I remove the field from the entity and re-create it with the exact same data AND after that import via SQL the original data into the db. Everything works.

    Which leads me to believe that something in the Drupal registry about the storage_data fields is messed up. But because it is Drupal I have no idea where that is and I cannot give advice what to do without deleting and recreating the same data. :-(

    To reinterate: I made a Drupal 9 to 10 update prior to this problem.

  • πŸ‡©πŸ‡ͺGermany ro-no-lo

    OMG I found a solution. Maybe it is helpful to someone. After Updating to Drupal 10, Drupal lost the *Reference Method* of the Entity. It told me that the selection handler is broken. It could also be, that the uninstall of WMBert as a WIDGET! was the cause. I don't know. Anyways, when I change it to default and pick the correct Entity (storage data) then everything works as expected. (See both screenshots)

  • Status changed to Closed: outdated 4 months ago
Production build 0.69.0 2024