- Issue created by @MegaKeegMan
- Status changed to Postponed: needs info
11 months ago 10:49am 25 December 2023 - π©πͺGermany Anybody Porta Westfalica
Thanks for your report @MegaKeegMan. I can't yet imagine, how this module should cause that issue.
Could you please write down steps to reproduce this in a fresh Drupal environment? My bet is, that this module is not causing the issue, but it's due to other, individual reasons. But I'm happy to help, if we can reproduce this in vanilla.
- πΊπΈUnited States MegaKeegMan
You are right. I am unable to reproduce this on a fresh Drupal instance. I do not understand either why I am hitting this error on the site for which I am looking to use this module. All I know is that it does not occur when this module is not enabled. I will report back if I learn anything. Thanks getting back to me!
- π©πͺGermany Anybody Porta Westfalica
Thanks @MegaKeegMan! Sorry I also don't have an idea, but I think you should link for orphaned entries of your "field_another_test" field in your config and remove them. Looks like the field was created partially.
Does the error occur for any random field name you choose?
- πΊπΈUnited States MegaKeegMan
Yes, it occurs no matter which field name I choose. I checked my config and found no traces of any of the fields. I don't believe the error to be accurate. I will investigate it again, but I have some other priorities at the moment.
- Assigned to Grevil
- Status changed to Active
10 months ago 5:51pm 16 January 2024 - π©πͺGermany Anybody Porta Westfalica
Hooray, I was now able to reproduce the issue with a Media reference field in Drupal 10.2.1!
In the first step, when I select a media type, the AJAX spinner loads and afterwards the submit button hasdisabled
and in the log I can see the error:Drupal\Core\Entity\EntityStorageException: 'field_storage_config' entity with ID 'commerce_product_variation.field_coverimage' already exists. in Drupal\Core\Entity\EntityStorageBase->doPreSave() (Zeile 519 in /web/core/lib/Drupal/Core/Entity/EntityStorageBase.php).
The backtrace then lists this module's hook:
#4 web/modules/contrib/entity_access_by_reference_field/entity_access_by_reference_field.module(201): Drupal\Core\Config\Entity\ConfigEntityBase->save() #5 [internal function]: entity_access_by_reference_field_field_config_edit_form_builder()
- π©πͺGermany Anybody Porta Westfalica
@MegaKeegMan did you find any fix in the meantime which you could provide as MR for a starting point?
- π©πͺGermany Anybody Porta Westfalica
The technical reason is the ->save() call here:
function entity_access_by_reference_field_field_config_edit_form_builder($entity_type, FieldStorageConfig $storage, array &$form, FormStateInterface $form_state) { $storage->setThirdPartySetting('entity_access_by_reference_field', 'enable_referenced_entity_permission', $form_state->getValue('enable_referenced_entity_permission')); $storage->setThirdPartySetting('entity_access_by_reference_field', 'permission_matrix', $form_state->getValue('permission_matrix')); $storage->setThirdPartySetting('entity_access_by_reference_field', 'access_fallback', $form_state->getValue('access_fallback')); $storage->setThirdPartySetting('entity_access_by_reference_field', 'access_fallback_empty', $form_state->getValue('access_fallback_empty')); $storage->setThirdPartySetting('entity_access_by_reference_field', 'multiple_entities_behavior', $form_state->getValue('multiple_entities_behavior')); $storage->save(); }
We should try if it works without the explicit
->save()
that would be the most simple solution.Otherwise, we would need to find out, when this may be saved and when not. In this case it's definitely to early and triggered by the AJAX call!
- πΊπΈUnited States MegaKeegMan
No, but if I had a fix I would absolutely contribute it. I have actually switched to using the access policy module for my current project. I was a bit hesitant to use it at first because it is pretty complex, but I am happy to be learning it now. I am glad that you were able to reproduce the issue, though. It is a pretty strange one.
- First commit to issue fork.
- π©πͺGermany Grevil
I can replicate this issue with ANY referenced type. Whether it is a content reference field, taxonomy field or media reference field!!!
Quite disturbing actually... this module is quite well tested, but we always create the fields programmatically for the setup.... definitely adding some UI field setup tests!
- π©πͺGermany Grevil
Ok, I found a similiar issue in field_permissions. Seems, that this is a D 10.2 only issue, see π D10.2, Add Select field Error Fixed .
- π©πͺGermany Anybody Porta Westfalica
Nice!!! The fix seems fine, but please add a comment leading to this issue :D
- Merge request !10Issue #3410606 by Grevil, MegaKeegMan, Anybody: Make the module Drupal 10.2.x compatible (Cannot create new fields) β (Merged) created by Grevil
- last update
10 months ago 18 pass - π©πͺGermany Grevil
Again, thanks @MegaKeegMan! Since 10.2 quite a bit changed for the field storage settings and field settings page! They both got merged into one, even though they tried to preserve the functionality for the field_config and field_storage_config hooks for normal configs, the field_storage_config hook seems to be broken for third party settings.
But we can now delete our old field_config hook and just put the storage hook code into the field_config hook implementation! Saving us a few lines of code and a working module with Drupal 10.2!
Please review!
- Issue was unassigned.
- Status changed to Needs review
10 months ago 11:50am 22 January 2024 -
Grevil β
committed 062e584d on 1.x
Related to Issue #3410606: Remove compatibility with Drupal 10.2 and...
-
Grevil β
committed 062e584d on 1.x
- last update
10 months ago 18 pass - last update
10 months ago 18 pass - π©πͺGermany Grevil
Concerning #11, it is currently not possible to create non JS tests, testing the creation of a field via UI.... The new UI simply doesn't work without JavaScript (At least not for reference fields)! π
And with JS it is a pain in the ass, since the ids are not very good and the "checkboxes" are not actual checkboxes but inputs with a preset value, so "checking" the input field with a value like "true" doesn't actually do anything. No idea how to test it if the test page mehtods like "$page->fillField()" or $page->checkField()" do not apply to these....
But yea we found the main issue, let's see if we can create some tests in the future, when they add non js support.
- π©πͺGermany Anybody Porta Westfalica
Reviewed just the code and LGTM!
We please need more feedback if it works and fixes the issues for anyone using 10.2 with this MR!
- Status changed to RTBC
10 months ago 2:37pm 22 January 2024 -
Grevil β
committed dc986e1f on 1.x
Issue #3410606 by Grevil, MegaKeegMan, Anybody: Make the module Drupal...
-
Grevil β
committed dc986e1f on 1.x
- Status changed to Fixed
10 months ago 2:44pm 22 January 2024 Automatically closed - issue fixed for 2 weeks with no activity.