class SerializedData in REST Views 2.0.x
Same name and namespace in other branches
- 8 src/SerializedData.php \Drupal\rest_views\SerializedData
Wrapper for passing serialized data through render arrays.
Hierarchy
- class \Drupal\rest_views\SerializedData
Expanded class hierarchy of SerializedData
See also
\Drupal\rest_views\Normalizer\DataNormalizer
13 files declare their use of SerializedData
- BooleanExportFormatter.php in src/
Plugin/ Field/ FieldFormatter/ BooleanExportFormatter.php - DataNormalizer.php in src/
Normalizer/ DataNormalizer.php - EntityFieldExport.php in src/
Plugin/ views/ field/ EntityFieldExport.php - EntityFieldExportTest.php in tests/
src/ Unit/ EntityFieldExportTest.php - EntityReferenceExportFormatter.php in src/
Plugin/ Field/ FieldFormatter/ EntityReferenceExportFormatter.php
File
- src/
SerializedData.php, line 10
Namespace
Drupal\rest_viewsView source
class SerializedData {
/**
* The wrapped data.
*
* @var mixed
*/
protected $data;
/**
* SerializedData constructor.
*
* @param mixed $data
* The wrapped data.
*/
public function __construct($data) {
$this->data = $data;
}
/**
* Create a serialized data object.
*
* @param mixed $data
* The wrapped data.
*
* @return static
*/
public static function create($data) {
if ($data instanceof static) {
return $data;
}
return new static($data);
}
/**
* Convert renderable object to a string.
*
* This function needs to return a non-empty string in order to be processed
* correctly by Drupal's rendering system.
*
* @return string
* A placeholder string representation.
*/
public function __toString() {
// This must not be empty.
return '[...]';
}
/**
* Extract the wrapped data.
*
* @return mixed
* The wrapped data.
*/
public function getData() {
return $this->data;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SerializedData:: |
protected | property | The wrapped data. | |
SerializedData:: |
public static | function | Create a serialized data object. | |
SerializedData:: |
public | function | Extract the wrapped data. | |
SerializedData:: |
public | function | SerializedData constructor. | |
SerializedData:: |
public | function | Convert renderable object to a string. |