Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299620

Remove duplicate check for "FieldableEntity" in EntityDisplayBase

$
0
0

EntityDisplayBase::getFieldDefinitions() checks that the $entity_type the Display applies to is Fieldable :

    // Entity displays are sometimes created for non-content entities.
    // @todo Prevent this in https://drupal.org/node/2095195.
    if (!\Drupal::entityManager()->getDefinition($this->targetEntityType)->isSubclassOf('\Drupal\Core\Entity\FieldableEntityInterface')) {
      return array();
    }

That same check is performed in the __construct() :

    if (!$this->entityManager()->getDefinition($values['targetEntityType'])->isSubclassOf('\Drupal\Core\Entity\FieldableEntityInterface')) {
      throw new \InvalidArgumentException('EntityDisplay entities can only handle content entity types.');
    }

- We could remove the check in getFieldDefinitions()
- Not sure why we check Fieldable. EntityDisplays should be about ContentEntities, but no reason to limit to those with fields.. OK, FieldableEntitiyInterface is larger than ContentEntityInterface. Then the exception message needs to be updated.


Viewing all articles
Browse latest Browse all 299620

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>