ComputedTestCacheableStringItem.php

Same filename in other branches
  1. 9 core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ComputedTestCacheableStringItem.php
  2. 11.x core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ComputedTestCacheableStringItem.php

Namespace

Drupal\entity_test\Plugin\Field\FieldType

File

core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ComputedTestCacheableStringItem.php

View source
<?php

namespace Drupal\entity_test\Plugin\Field\FieldType;

use Drupal\Core\Field\Attribute\FieldType;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Field\Plugin\Field\FieldType\StringItem;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\TypedData\DataDefinition;

/**
 * Defines the 'string' entity field type with cacheability metadata.
 */
class ComputedTestCacheableStringItem extends StringItem {
    
    /**
     * {@inheritdoc}
     */
    public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
        $properties['value'] = DataDefinition::create('computed_test_cacheable_string')->setLabel(new TranslatableMarkup('Text value'))
            ->setSetting('case_sensitive', $field_definition->getSetting('case_sensitive'))
            ->setRequired(TRUE);
        return $properties;
    }

}

Classes

Title Deprecated Summary
ComputedTestCacheableStringItem Defines the 'string' entity field type with cacheability metadata.

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