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

amateescu’s picture

Yeah, that was the quickest way I could find in the original conversion issues, and I agree that it looks wonky.. :/

jibran’s picture

Issue tags: +Field API, +Entity Field API

Tagging.

jibran’s picture

Issue summary: View changes

reformat

Berdir’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)

We're no longer doing this :)