You are here

public function LingotekConfigTranslationService::getTranslatableProperties in Lingotek Translation 3.5.x

Same name and namespace in other branches
  1. 8 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()
  2. 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()
  3. 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()
  4. 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()
  5. 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()
  6. 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()
  7. 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()
  8. 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()
  9. 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()
  10. 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()
  11. 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getTranslatableProperties()

Get the translatable properties for this schema.

Parameters

\Drupal\Core\TypedData\TraversableTypedDataInterface $schema: The schema we need to extract the properties from.

string $prefix: The prefix to be used for constructing the canonical name.

Return value

array An array of the canonical-named properties.

Overrides LingotekConfigTranslationServiceInterface::getTranslatableProperties

1 call to LingotekConfigTranslationService::getTranslatableProperties()
LingotekConfigTranslationService::getConfigTranslatableProperties in src/LingotekConfigTranslationService.php
Gets the configuration translatable properties of the given mapper.

File

src/LingotekConfigTranslationService.php, line 144

Class

LingotekConfigTranslationService
Service for managing Lingotek configuration translations.

Namespace

Drupal\lingotek

Code

public function getTranslatableProperties(TraversableTypedDataInterface $schema, $base_key) {
  $properties = [];
  $definition = $schema
    ->getDataDefinition();
  if (isset($definition['form_element_class'])) {
    foreach ($schema as $key => $element) {
      $element_key = isset($base_key) ? "{$base_key}.{$key}" : $key;
      $definition = $element
        ->getDataDefinition();
      if ($element instanceof TraversableTypedDataInterface) {
        $properties = array_merge($properties, $this
          ->getTranslatableProperties($element, $element_key));
      }
      else {
        if (isset($definition['form_element_class'])) {
          $properties[] = $element_key;
        }
      }
    }
  }
  return $properties;
}