class EntityShareSerializedDataEnhancer in Entity Share 8.3
Prepare paragraph serialized data value.
Plugin annotation
@ResourceFieldEnhancer(
id = "entity_share_serialized_data",
label = @Translation("Serialized Data (Entity Share)"),
description = @Translation("Prepare serialized data to be shared."),
)
Hierarchy
- class \Drupal\entity_share\Plugin\jsonapi\FieldEnhancer\EntityShareSerializedDataEnhancer extends \Drupal\jsonapi_extras\Plugin\ResourceFieldEnhancerBase
Expanded class hierarchy of EntityShareSerializedDataEnhancer
File
- src/
Plugin/ jsonapi/ FieldEnhancer/ EntityShareSerializedDataEnhancer.php, line 19
Namespace
Drupal\entity_share\Plugin\jsonapi\FieldEnhancerView source
class EntityShareSerializedDataEnhancer extends ResourceFieldEnhancerBase {
/**
* {@inheritdoc}
*/
protected function doTransform($data, Context $context) {
return is_array($data) ? [
'value' => $data,
] : $data;
}
/**
* {@inheritdoc}
*/
protected function doUndoTransform($data, Context $context) {
return !empty($data['value']) ? $data['value'] : $data;
}
/**
* {@inheritdoc}
*/
public function getOutputJsonSchema() {
return [
'type' => 'object',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityShareSerializedDataEnhancer:: |
protected | function | ||
EntityShareSerializedDataEnhancer:: |
protected | function | ||
EntityShareSerializedDataEnhancer:: |
public | function |