You are here

protected function ConfigMapperManager::findTranslatable in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/config_translation/src/ConfigMapperManager.php \Drupal\config_translation\ConfigMapperManager::findTranslatable()
  2. 9 core/modules/config_translation/src/ConfigMapperManager.php \Drupal\config_translation\ConfigMapperManager::findTranslatable()

Returns TRUE if at least one translatable element is found.

Parameters

\Drupal\Core\TypedData\TypedDataInterface $element: Configuration schema element.

Return value

bool A boolean indicating if there is at least one translatable element.

1 call to ConfigMapperManager::findTranslatable()
ConfigMapperManager::hasTranslatable in core/modules/config_translation/src/ConfigMapperManager.php
Returns TRUE if the configuration data has translatable items.

File

core/modules/config_translation/src/ConfigMapperManager.php, line 181

Class

ConfigMapperManager
Manages plugins for configuration translation mappers.

Namespace

Drupal\config_translation

Code

protected function findTranslatable(TypedDataInterface $element) {

  // In case this is a sequence or a mapping check whether any child element
  // is translatable.
  if ($element instanceof TraversableTypedDataInterface) {
    foreach ($element as $child_element) {
      if ($this
        ->findTranslatable($child_element)) {
        return TRUE;
      }
    }

    // If none of the child elements are translatable, return FALSE.
    return FALSE;
  }
  else {
    $definition = $element
      ->getDataDefinition();
    return isset($definition['translatable']) && $definition['translatable'];
  }
}