Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConfigMapperManager.php

function 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

File

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

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'];
    }
}
RSS feed
Powered by Drupal