Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
FieldItem classes extending EntityReferenceItem have code like:
FileItem:
public function getPropertyDefinitions() {
$this->definition['settings']['target_type'] = 'file';
TaxonomyTermReferenceItem:
public function getPropertyDefinitions() {
$this->definition['settings']['target_type'] = 'taxonomy_term';
This looks really weird. getPropertyDefinitions() is not the place to put side effects and assign missing properties in $this->definition['settings'] - what if the the Item object is used without getPropertyDefinitions() being called ?
Not sure where/how this 'target_type' property can be set, but we should look for another way.
Comments
Comment #1
amateescu CreditAttribution: amateescu commentedYeah, that was the quickest way I could find in the original conversion issues, and I agree that it looks wonky.. :/
Comment #2
jibranTagging.
Comment #2.0
jibranreformat
Comment #3
BerdirWe're no longer doing this :)