trait ContentFieldMetadataTrait in Acquia Content Hub 8.2
Trait to set content field metadata.
@package Drupal\acquia_contenthub\EventSubscriber\SerializeContentField
Hierarchy
- trait \Drupal\acquia_contenthub\EventSubscriber\SerializeContentField\ContentFieldMetadataTrait
1 file declares its use of ContentFieldMetadataTrait
- EntityMetatagsSerializer.php in modules/
acquia_contenthub_metatag/ src/ EventSubscriber/ SerializeContentField/ EntityMetatagsSerializer.php
File
- src/
EventSubscriber/ SerializeContentField/ ContentFieldMetadataTrait.php, line 12
Namespace
Drupal\acquia_contenthub\EventSubscriber\SerializeContentFieldView source
trait ContentFieldMetadataTrait {
/**
* Sets field metadata.
*
* @param \Drupal\acquia_contenthub\Event\SerializeCdfEntityFieldEvent $event
* Event.
*/
protected function setFieldMetaData(SerializeCdfEntityFieldEvent $event) {
$cdf = $event
->getCdf();
$metadata = $cdf
->getMetadata();
$metadata['field'][$event
->getFieldName()]['type'] = $event
->getField()
->getFieldDefinition()
->getType();
$cdf
->setMetadata($metadata);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentFieldMetadataTrait:: |
protected | function | Sets field metadata. |