public function FileEntityHandler::onCreateCdf in Acquia Content Hub 8.2
Add attributes to file entity CDF representations.
Parameters
\Drupal\acquia_contenthub\Event\CreateCdfEntityEvent $event: The create CDF entity event.
File
- src/
EventSubscriber/ Cdf/ FileEntityHandler.php, line 60
Class
- FileEntityHandler
- Manipulates file content entity CDF representation to better support files.
Namespace
Drupal\acquia_contenthub\EventSubscriber\CdfCode
public function onCreateCdf(CreateCdfEntityEvent $event) {
if ($event
->getEntity()
->getEntityTypeId() == 'file') {
/** @var \Drupal\file\FileInterface $entity */
$entity = $event
->getEntity();
$handler = $this->manager
->getHandlerForFile($entity);
$handler
->addAttributes($event
->getCdf($entity
->uuid()), $entity);
}
}