function ViewsTestEntity::baseFieldDefinitions

Same name in other branches
  1. 10 core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php \Drupal\Tests\views\Kernel\Entity\ViewsTestEntity::baseFieldDefinitions()
  2. 11.x core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php \Drupal\Tests\views\Kernel\Entity\ViewsTestEntity::baseFieldDefinitions()

Overrides ContentEntityBase::baseFieldDefinitions

File

core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php, line 859

Class

ViewsTestEntity
Generic entity class for our test entity types.

Namespace

Drupal\Tests\views\Kernel\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);
    if (isset(static::$mockedBaseFieldDefinitions[$entity_type->id()])) {
        $mocked_fields = static::$mockedBaseFieldDefinitions[$entity_type->id()];
        // Mocked fields take priority over ones from the base class.
        $fields = $mocked_fields + $fields;
    }
    return $fields;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.