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

Core/FieldType/Null/Type.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType\Null;
8
9 use eZ\Publish\Core\FieldType\FieldType;
10 use eZ\Publish\SPI\FieldType\Value as SPIValue;
11 use eZ\Publish\Core\FieldType\Value as BaseValue;
12
16 class Type extends FieldType
17 {
23 protected $fieldTypeIdentifier;
24
32 public function __construct($fieldTypeIdentifier)
33 {
34 $this->fieldTypeIdentifier = $fieldTypeIdentifier;
35 }
36
42 public function getFieldTypeIdentifier()
43 {
44 return $this->fieldTypeIdentifier;
45 }
46
57 public function getName(SPIValue $value)
58 {
59 return (string)$value->value;
60 }
61
68 public function getEmptyValue()
69 {
70 return new Value(null);
71 }
72
80 protected function createValueFromInput($inputValue)
81 {
82 return $inputValue;
83 }
84
92 protected function checkValueStructure(BaseValue $value)
93 {
94 // Does nothing
95 }
96
100 protected function getSortInfo(BaseValue $value)
101 {
102 return null;
103 }
104
112 public function fromHash($hash)
113 {
114 return new Value($hash);
115 }
116
124 public function toHash(SPIValue $value)
125 {
126 if (isset($value->value)) {
127 return $value->value;
128 }
129
130 return null;
131 }
132
138 public function isSearchable()
139 {
140 return true;
141 }
142 }
eZ\Publish\Core\FieldType\FieldType
Base class for field types, the most basic storage unit of data inside eZ Publish.
Definition: Core/FieldType/FieldType.php:35
eZ\Publish\Core\FieldType\Null\Type
ATTENTION: For testing purposes only!
Definition: Core/FieldType/Null/Type.php:17
eZ\Publish\Core\FieldType\Null\Type\getEmptyValue
getEmptyValue()
Returns the fallback default value of field type when no such default value is provided in the field ...
Definition: Core/FieldType/Null/Type.php:68
eZ\Publish\Core\FieldType\Null\Type\checkValueStructure
checkValueStructure(BaseValue $value)
Throws an exception if value structure is not of expected format.
Definition: Core/FieldType/Null/Type.php:92
eZ\Publish\Core\FieldType\Null\Type\toHash
toHash(SPIValue $value)
Converts a $Value to a hash.
Definition: Core/FieldType/Null/Type.php:124
eZ\Publish\Core\FieldType\Null\Type\__construct
__construct($fieldTypeIdentifier)
Constructs field type object, initializing internal data structures.
Definition: Core/FieldType/Null/Type.php:32
eZ\Publish\Core\FieldType\Null\Type\isSearchable
isSearchable()
Returns whether the field type is searchable.
Definition: Core/FieldType/Null/Type.php:138
eZ\Publish\Core\FieldType\Null\Type\getSortInfo
getSortInfo(BaseValue $value)
{}
Definition: Core/FieldType/Null/Type.php:100
eZ\Publish\Core\FieldType\Null\Type\$fieldTypeIdentifier
$fieldTypeIdentifier
Definition: Core/FieldType/Null/Type.php:23
eZ\Publish\Core\FieldType\Null\Type\getFieldTypeIdentifier
getFieldTypeIdentifier()
Returns the field type identifier for this field type.
Definition: Core/FieldType/Null/Type.php:42
eZ\Publish\Core\FieldType\Null\Type\createValueFromInput
createValueFromInput($inputValue)
Inspects given $inputValue and potentially converts it into a dedicated value object.
Definition: Core/FieldType/Null/Type.php:80
eZ\Publish\Core\FieldType\Null\Type\getName
getName(SPIValue $value)
Returns the name of the given field value.
Definition: Core/FieldType/Null/Type.php:57
eZ\Publish\Core\FieldType\Null\Type\fromHash
fromHash($hash)
Converts an $hash to the Value defined by the field type.
Definition: Core/FieldType/Null/Type.php:112
eZ\Publish\Core\FieldType\Null\Value
Value for Null field type.
Definition: Core/FieldType/Null/Value.php:15
eZ\Publish\Core\FieldType\Value
Abstract class for all field value classes.
Definition: Core/FieldType/Value.php:17
eZ\Publish\SPI\FieldType\Value
Interface for field value classes.
Definition: SPI/FieldType/Value.php:13
eZ\Publish\Core\FieldType\Null
Definition: Core/FieldType/Null/Type.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.