ConfigMapperManager::findTranslatable

protected ConfigMapperManager::findTranslatable(TypedDataInterface $element)

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.

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'];
  }
}
doc_Drupal
2016-10-29 08:54:11
Comments
Leave a Comment

Please login to continue.