You are here

public function ConfigurableLanguageHandler::onCreateCdf in Acquia Content Hub 8.2

Adds the langcode metadata to configurable_language cdf objects.

Parameters

\Drupal\acquia_contenthub\Event\CreateCdfEntityEvent $event: The parse cdf entity event object.

File

src/EventSubscriber/Cdf/ConfigurableLanguageHandler.php, line 30

Class

ConfigurableLanguageHandler
Handler for configurable languages.

Namespace

Drupal\acquia_contenthub\EventSubscriber\Cdf

Code

public function onCreateCdf(CreateCdfEntityEvent $event) {
  $entity = $event
    ->getEntity();
  if ($entity
    ->getEntityTypeId() !== 'configurable_language') {
    return;
  }
  $cdf = $event
    ->getCdf($entity
    ->uuid());
  $metadata = $cdf
    ->getMetadata();
  $metadata['langcode'] = $entity
    ->id();
  $cdf
    ->setMetadata($metadata);
}