- 🇩🇪Germany Anybody Porta Westfalica
Thank you very much @jonathan_hunt. Could you please add tests, so we can be sure this works as expected for now and in the future?
- First commit to issue fork.
- 🇨🇦Canada rosiel
I'm revisiting this as it's desired by the Islandora community.
Is it possible to add tests for a field type that's defined by another module? I don't think further tests are possible unless we mock up a shim for the 'typed_relation' field type. That seems like overkill...
Alternately, instead of testing
$field_definition->getType()
, we could testis_a($fieldDefinition->getClass(), 'Drupal\Core\Field\EntityReferenceFieldItemList', true)
. That would work both for entity reference fields and any field type that extends entity reference, including typed relation. This might prevent the need for any additional tests. - First commit to issue fork.
- 🇨🇦Canada bibliophileaxe
I've updated the code to check if the field class is an instance of EntityReferenceFieldItemList rather than adding a condition for another module. I agree with Rosie's comment that this does not require tests now as the current tests already check for this.
I'd rather have an Event that could add additional context/conditions to make this more robust but since that would be a considerable change, this seems to be a decent solution.