public function EntityTranslationController::entityFormSharedElements

Process callback: Determines which elements get clue in the form.

Parameters

array $element: Form API element.

Return value

array A processed element with the shared elements marked with a clue.

See also

\Drupal\translation_entity\EntityTranslationController::entityFormAlter()

File

drupal/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php, line 272
Definition of Drupal\translation_entity\EntityTranslationController.

Class

EntityTranslationController
Base class for entity translation controllers.

Namespace

Drupal\translation_entity

Code

public function entityFormSharedElements($element) {
  static $ignored_types;

  // @todo Find a more reliable way to determine if a form element concerns a
  //   multilingual value.
  if (!isset($ignored_types)) {
    $ignored_types = array_flip(array(
      'actions',
      'value',
      'hidden',
      'vertical_tabs',
      'token',
    ));
  }
  foreach (element_children($element) as $key) {
    if (!isset($element[$key]['#type'])) {
      $this
        ->entityFormSharedElements($element[$key]);
    }
    else {

      // Ignore non-widget form elements.
      if (isset($ignored_types[$element[$key]['#type']])) {
        continue;
      }

      // Elements are considered to be non multilingual by default.
      if (empty($element[$key]['#multilingual'])) {
        $this
          ->addTranslatabilityClue($element[$key]);
      }
    }
  }
  return $element;
}