SerializedItem.php
Same filename in other branches
Namespace
Drupal\entity_test\Plugin\Field\FieldTypeFile
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ Plugin/ Field/ FieldType/ SerializedItem.php
View source
<?php
declare (strict_types=1);
namespace Drupal\entity_test\Plugin\Field\FieldType;
use Drupal\Core\Field\Attribute\FieldType;
use Drupal\Core\Field\FieldItemBase;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\TypedData\DataDefinition;
/**
* Defines the 'serialized_item' entity field type.
*/
class SerializedItem extends FieldItemBase {
/**
* {@inheritdoc}
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['value'] = DataDefinition::create('string')->setLabel(new TranslatableMarkup('Test serialized value'))
->setRequired(TRUE);
return $properties;
}
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition) {
return [
'columns' => [
'value' => [
'type' => 'blob',
'size' => 'big',
'serialize' => TRUE,
],
],
];
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
SerializedItem | Defines the 'serialized_item' entity field type. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.