public ContentTranslationHandler::entityFormSharedElements($element, FormStateInterface $form_state, $form)
Process callback: determines which elements get clue in the form.
See also
\Drupal\content_translation\ContentTranslationHandler::entityFormAlter()
File
- core/modules/content_translation/src/ContentTranslationHandler.php, line 491
Class
- ContentTranslationHandler
- Base class for content translation handlers.
Namespace
Drupal\content_translation
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | public function entityFormSharedElements( $element , FormStateInterface $form_state , $form ) { 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' , 'details' )); } foreach (Element::children( $element ) as $key ) { if (!isset( $element [ $key ][ '#type' ])) { $this ->entityFormSharedElements( $element [ $key ], $form_state , $form ); } 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' ])) { // If we are displaying a multilingual entity form we need to provide // translatability clues, otherwise the shared form elements should be // hidden. if (! $form_state ->get([ 'content_translation' , 'translation_form' ])) { $this ->addTranslatabilityClue( $element [ $key ]); } else { $element [ $key ][ '#access' ] = FALSE; } } } } return $element ; } |
Please login to continue.