function ArrayElement::hasTranslatableElements

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Config/Schema/ArrayElement.php \Drupal\Core\Config\Schema\ArrayElement::hasTranslatableElements()

Determines if there is a translatable value.

Return value

bool Returns true if a translatable element is found.

File

core/lib/Drupal/Core/Config/Schema/ArrayElement.php, line 23

Class

ArrayElement
Defines a generic configuration element that contains multiple properties.

Namespace

Drupal\Core\Config\Schema

Code

public function hasTranslatableElements() : bool {
  foreach ($this as $element) {
    // Early return if found.
    if ($element->getDataDefinition()['translatable'] === TRUE) {
      return TRUE;
    }
    if ($element instanceof ArrayElement && $element->hasTranslatableElements()) {
      return TRUE;
    }
  }
  return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.