public function NodeRevisionRevertTranslationForm::buildForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php \Drupal\node\Form\NodeRevisionRevertTranslationForm::buildForm()
- 9 core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php \Drupal\node\Form\NodeRevisionRevertTranslationForm::buildForm()
File
- core/
modules/ node/ src/ Form/ NodeRevisionRevertTranslationForm.php, line 87
Class
- NodeRevisionRevertTranslationForm
- Provides a form for reverting a node revision for a single translation.
Namespace
Drupal\node\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $node_revision = NULL, $langcode = NULL) {
$this->langcode = $langcode;
$form = parent::buildForm($form, $form_state, $node_revision);
// Unless untranslatable fields are configured to affect only the default
// translation, we need to ask the user whether they should be included in
// the revert process.
$default_translation_affected = $this->revision
->isDefaultTranslationAffectedOnly();
$form['revert_untranslated_fields'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Revert content shared among translations'),
'#default_value' => $default_translation_affected && $this->revision
->getTranslation($this->langcode)
->isDefaultTranslation(),
'#access' => !$default_translation_affected,
];
return $form;
}