EntityTestMulDefaultValue.php

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

Namespace

Drupal\entity_test\Entity

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulDefaultValue.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_mul_default_value",
 *   label = @Translation("Test entity - multiple default value and 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"
 *   },
 *   base_table = "entity_test_mul_default_value",
 *   data_table = "entity_test_mul_default_value_property_data",
 *   translatable = TRUE,
 *   entity_keys = {
 *     "id" = "id",
 *     "uuid" = "uuid",
 *     "bundle" = "type",
 *     "label" = "name",
 *     "langcode" = "langcode"
 *   },
 *   links = {
 *     "canonical" = "/entity_test_mul_default_value/manage/{entity_test_mul_default_value}",
 *     "edit-form" = "/entity_test_mul_default_value/manage/{entity_test_mul_default_value}",
 *     "delete-form" = "/entity_test/delete/entity_test_mul_default_value/{entity_test_mul_default_value}",
 *   },
 *   field_ui_base_route = "entity.entity_test_mul.admin_form",
 * )
 */
class EntityTestMulDefaultValue extends EntityTestMul {
    
    /**
     * {@inheritdoc}
     */
    public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
        $fields = parent::baseFieldDefinitions($entity_type);
        $fields['description'] = BaseFieldDefinition::create('shape')->setLabel(t('Some custom description'))
            ->setTranslatable(TRUE)
            ->setDefaultValueCallback('entity_test_field_default_value');
        return $fields;
    }

}

Classes

Title Deprecated Summary
EntityTestMulDefaultValue Defines the test entity class.

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