EntityTestFieldMethods.php

Same filename in other branches
  1. 9 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestFieldMethods.php
  2. 10 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestFieldMethods.php
  3. 11.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestFieldMethods.php

Namespace

Drupal\entity_test\Entity

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTestFieldMethods.php

View source
<?php

namespace Drupal\entity_test\Entity;

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

/**
 * Defines the test entity class.
 *
 * @ContentEntityType(
 *   id = "entity_test_field_methods",
 *   label = @Translation("Test entity - data table"),
 *   handlers = {
 *     "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
 *     "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
 *     "form" = {
 *       "default" = "Drupal\entity_test\EntityTestForm",
 *       "delete" = "Drupal\entity_test\EntityTestDeleteForm"
 *     },
 *     "views_data" = "Drupal\views\EntityViewsData",
 *     "route_provider" = {
 *       "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
 *     },
 *   },
 *   base_table = "entity_test_field_methods",
 *   data_table = "entity_test_field_methods_property",
 *   admin_permission = "administer entity_test content",
 *   translatable = TRUE,
 *   entity_keys = {
 *     "id" = "id",
 *     "uuid" = "uuid",
 *     "bundle" = "type",
 *     "label" = "name",
 *     "langcode" = "langcode",
 *   },
 * )
 */
class EntityTestFieldMethods extends EntityTestMul {
    
    /**
     * {@inheritdoc}
     */
    public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
        $fields = parent::baseFieldDefinitions($entity_type);
        $fields['test_invocation_order'] = BaseFieldDefinition::create('auto_incrementing_test')->setLabel(t('Test field method invocation order.'))
            ->setTranslatable(TRUE);
        return $fields;
    }

}

Classes

Title Deprecated Summary
EntityTestFieldMethods Defines the test entity class.

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