EntityTestMulChanged.php

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

Namespace

Drupal\entity_test\Entity

File

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

View source
<?php

declare (strict_types=1);
namespace Drupal\entity_test\Entity;

use Drupal\Core\Entity\Attribute\ContentEntityType;
use Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\entity_test\EntityTestAccessControlHandler;
use Drupal\entity_test\EntityTestDeleteForm;
use Drupal\entity_test\EntityTestForm;
use Drupal\entity_test\EntityTestViewBuilder as TestViewBuilder;
use Drupal\views\EntityViewsData;

/**
 * Defines the test entity class.
 */
class EntityTestMulChanged extends EntityTestMul implements EntityChangedInterface {
    use EntityChangedTrait;
    
    /**
     * {@inheritdoc}
     */
    public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
        $fields = parent::baseFieldDefinitions($entity_type);
        $fields['changed'] = BaseFieldDefinition::create('changed_test')->setLabel(t('Changed'))
            ->setDescription(t('The time that the entity was last edited.'))
            ->setTranslatable(TRUE);
        $fields['not_translatable'] = BaseFieldDefinition::create('string')->setLabel(t('Non translatable'))
            ->setDescription(t('A non-translatable string field'));
        return $fields;
    }
    
    /**
     * {@inheritdoc}
     */
    public function save() {
        // Ensure a new timestamp.
        sleep(1);
        return parent::save();
    }

}

Classes

Title Deprecated Summary
EntityTestMulChanged Defines the test entity class.

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