- Issue created by @cgmonroe
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
+++ b/src/Form/EntityUsageSettingsForm.php @@ -113,8 +114,13 @@ class EntityUsageSettingsForm extends ConfigFormBase { + // If the entity type doesn't have fields it can't be a source, e.g. views + if (method_exists($entity_type->getOriginalClass(), 'getFields')) { + $source_options[$entity_type->id()] = $entity_type->getLabel();
I think we should be checking FieldableEntityInterface so something like:
if ($entity_type->entityClassImplements(FieldableEntityInterface::class)) { $source_options[$entity_type->id()] = $entity_type->getLabel(); }
You will need to add a use statement too.
FWIW I think this is a bug.
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
I think theoretically you could implement any entity tracking plugin that does not use fields BUT the entity track plugin definition has
field_types
so it is going to be quite hard.But this potentially would break such a use-case. Maybe the way around this is to look at all the entity track plugins and check to see if the extend from \Drupal\entity_usage\EntityUsageTrackBase - if they all do then there we should not include non-fiedldable types. This would improve the UI for 99.5% of users.
- Merge request !116Issue #3505220: Limited source entities in settings to ones that have fields. → (Open) created by sayan_k_dutta
- 🇮🇳India sayan_k_dutta
Checking using FieldableEntityInterface seems to filter out the entity types without any fields from the source entities list. Created the MR !116 according to it.
I have not tried using the EntityUsageTrackBase as I am not clear of the idea of how to use it to check for entities without fields.