class RenderableData in REST Views 2.0.x
Same name and namespace in other branches
- 8 src/RenderableData.php \Drupal\rest_views\RenderableData
Wrapper for renderable data that will be rendered during normalization.
@package Drupal\rest_views
Hierarchy
- class \Drupal\rest_views\RenderableData
Expanded class hierarchy of RenderableData
2 files declare their use of RenderableData
- EntityReferenceExportFormatter.php in src/
Plugin/ Field/ FieldFormatter/ EntityReferenceExportFormatter.php - RenderNormalizer.php in src/
Normalizer/ RenderNormalizer.php
File
- src/
RenderableData.php, line 10
Namespace
Drupal\rest_viewsView source
class RenderableData {
/**
* The render array.
*
* @var string
*/
protected $data;
/**
* RenderableData constructor.
*
* @param array $data
* The render array.
*/
public function __construct(array $data) {
$this->data = $data;
}
/**
* Create a renderable data object.
*
* @param array $data
* The render array.
*
* @return static
*/
public static function create(array $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 render array.
*
* @return mixed
* The render array.
*/
public function getData() {
return $this->data;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RenderableData:: |
protected | property | The render array. | |
RenderableData:: |
public static | function | Create a renderable data object. | |
RenderableData:: |
public | function | Extract the render array. | |
RenderableData:: |
public | function | RenderableData constructor. | |
RenderableData:: |
public | function | Convert renderable object to a string. |