- πΊπΈUnited States Chris Burge
I fully agree that we should get the field prefix from the field_ui.settings config rather than assume it is field_,
The field prefix can change, though. If we use the field prefix today, that may exclude fields created with an old prefix. The only time the field prefix is used is for field creation.
In the
CorrespondingReferenceForm
class, both->getFieldOptions()
and->getBundleOptions()
callgetReferenceFieldMap()
to populate their respectiveforeach
loops./** * Gets a map of possible reference fields. * * @return array * The reference field map. */ protected function getReferenceFieldMap() { $map = $this->fieldManager->getFieldMapByFieldType('entity_reference'); return $map; }
$this->fieldManager->getFieldMapByFieldType
only returns fields of type 'entity_reference'. Isn't that exactly what we need to begin with? If that's the case, then patch #4 fits the bill. - πΊπΈUnited States Chris Burge
I see what you mean about wanting to only return fields defined in config now:
#13 has the code to get that list. There may be valid cases for using CER with fields defined programmatically. What do you think about making the behavior configurable (behind a toggle)?
E.g.:
Which fields should be available for corresponding entity references?
O Fields defined in configuration (default)
O All fields