Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

MediaConverter.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter;
8
9 use eZ\Publish\Core\FieldType\Media\Type as MediaType;
10 use eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition;
11 use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition;
12 use eZ\Publish\Core\FieldType\FieldSettings;
13
14 class MediaConverter extends BinaryFileConverter
15 {
25 public static function create()
26 {
27 return new self();
28 }
29
36 public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
37 {
38 parent::toStorageFieldDefinition($fieldDef, $storageDef);
39
40 $storageDef->dataText1 = (isset($fieldDef->fieldTypeConstraints->fieldSettings['mediaType'])
41 ? $fieldDef->fieldTypeConstraints->fieldSettings['mediaType']
42 : MediaType::TYPE_HTML5_VIDEO);
43 }
44
51 public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
52 {
53 parent::toFieldDefinition($storageDef, $fieldDef);
54 $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings(
55 [
56 'mediaType' => $storageDef->dataText1,
57 ]
58 );
59 }
60
70 public function getIndexColumn()
71 {
72 return false;
73 }
74 }
eZ\Publish\Core\FieldType\FieldSettings
Container for field type specific properties.
Definition: FieldSettings.php:19
eZ\Publish\Core\FieldType\Media\Type
The TextLine field type.
Definition: Core/FieldType/Media/Type.php:22
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\BinaryFileConverter
Definition: BinaryFileConverter.php:17
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\MediaConverter
Definition: MediaConverter.php:15
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\MediaConverter\toStorageFieldDefinition
toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
Converts field definition data in $fieldDef into $storageFieldDef.
Definition: MediaConverter.php:36
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\MediaConverter\getIndexColumn
getIndexColumn()
Returns the name of the index column in the attribute table.
Definition: MediaConverter.php:70
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\MediaConverter\toFieldDefinition
toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
Converts field definition data in $storageDef into $fieldDef.
Definition: MediaConverter.php:51
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\MediaConverter\create
static create()
Factory for current class.
Definition: MediaConverter.php:25
eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition
Definition: StorageFieldDefinition.php:12
eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition
Definition: SPI/Persistence/Content/Type/FieldDefinition.php:18
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter
Definition: AuthorConverter.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.