You are here

public function OverridesSectionStorage::setTranslatedComponentConfiguration in Layout Builder Symmetric Translations 8

Sets the translated component configuration.

Parameters

string $uuid: The component UUID.

array $configuration: The component's translated configuration.

Overrides TranslatableSectionStorageInterface::setTranslatedComponentConfiguration

File

src/Plugin/SectionStorage/OverridesSectionStorage.php, line 63

Class

OverridesSectionStorage

Namespace

Drupal\layout_builder_st\Plugin\SectionStorage

Code

public function setTranslatedComponentConfiguration($uuid, array $configuration) {
  if (!$this
    ->getEntity()
    ->get(OverridesSectionStorage::TRANSLATED_CONFIGURATION_FIELD_NAME)
    ->isEmpty()) {
    $translation_settings = $this
      ->getEntity()
      ->get(OverridesSectionStorage::TRANSLATED_CONFIGURATION_FIELD_NAME)
      ->getValue()[0];
  }
  $translation_settings['value']['components'][$uuid] = $configuration;
  $this
    ->getEntity()
    ->set(OverridesSectionStorage::TRANSLATED_CONFIGURATION_FIELD_NAME, [
    $translation_settings,
  ]);
}