NoLanguageEntityTest.php

Same filename in other branches
  1. 9 core/modules/language/tests/language_test/src/Entity/NoLanguageEntityTest.php
  2. 8.9.x core/modules/language/tests/language_test/src/Entity/NoLanguageEntityTest.php
  3. 11.x core/modules/language/tests/language_test/src/Entity/NoLanguageEntityTest.php

Namespace

Drupal\language_test\Entity

File

core/modules/language/tests/language_test/src/Entity/NoLanguageEntityTest.php

View source
<?php

namespace Drupal\language_test\Entity;

use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;

/**
 * Defines the test entity class.
 *
 * @ContentEntityType(
 *   id = "no_language_entity_test",
 *   label = @Translation("Test entity without language support"),
 *   handlers = {
 *     "views_data" = "Drupal\entity_test\EntityTestViewsData"
 *   },
 *   base_table = "no_language_entity_test",
 *   persistent_cache = FALSE,
 *   entity_keys = {
 *     "id" = "id",
 *     "uuid" = "uuid",
 *   },
 * )
 */
class NoLanguageEntityTest extends ContentEntityBase {
    
    /**
     * {@inheritdoc}
     */
    public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
        $fields['id'] = BaseFieldDefinition::create('integer')->setLabel(t('ID'))
            ->setDescription(t('The ID of the test entity.'))
            ->setReadOnly(TRUE)
            ->setSetting('unsigned', TRUE);
        $fields['uuid'] = BaseFieldDefinition::create('uuid')->setLabel(t('UUID'))
            ->setDescription(t('The UUID of the test entity.'))
            ->setReadOnly(TRUE);
        return $fields;
    }

}

Classes

Title Deprecated Summary
NoLanguageEntityTest Defines the test entity class.

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