diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Form/TranslatableForm.php b/core/modules/content_translation/lib/Drupal/content_translation/Form/TranslatableForm.php
index bdeb983..f8d6e82 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Form/TranslatableForm.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Form/TranslatableForm.php
@@ -42,11 +42,11 @@ public function getFormID() {
* {@inheritdoc}
*/
public function getQuestion() {
- if ($field['translatable']) {
- $question = t('Are you sure you want to disable translation for the %name field?', array('%name' => $this->fieldName));
+ if ($this->fieldInfo['translatable']) {
+ $question = $this->t('Are you sure you want to disable translation for the %name field?', array('%name' => $this->fieldName));
}
else {
- $question = t('Are you sure you want to enable translation for the %name field?', array('%name' => $this->fieldName));
+ $question = $this->t('Are you sure you want to enable translation for the %name field?', array('%name' => $this->fieldName));
}
return $question;
}
@@ -55,10 +55,10 @@ public function getQuestion() {
* {@inheritdoc}
*/
public function getDescription() {
- $description = t('By submitting this form these changes will apply to the %name field everywhere it is used.',
+ $description = $this->t('By submitting this form these changes will apply to the %name field everywhere it is used.',
array('%name' => $this->fieldName)
);
- $description .= $this->fieldInfo['translatable'] ? "
" . t("All the existing translations of this field will be deleted.
This action cannot be undone.") : '';
+ $description .= $this->fieldInfo['translatable'] ? "
" . $this->t("All the existing translations of this field will be deleted.
This action cannot be undone.") : '';
return $description;
}
@@ -102,16 +102,18 @@ public function buildForm(array $form, array &$form_state, $field_name = NULL) {
public function submitForm(array &$form, array &$form_state) {
// This is the current state that we want to reverse.
$translatable = $form_state['values']['translatable'];
- if ($this->field['translatable'] !== $translatable) {
+ $t_args = array('%field_name' => $this->fieldName);
+ if ($this->fieldInfo['translatable'] !== $translatable) {
// Field translatability has changed since form creation, abort.
- $t_args = array('%field_name');
$msg = $translatable ?
- t('The field %field_name is already translatable. No change was performed.', $t_args):
- t('The field %field_name is already untranslatable. No change was performed.', $t_args);
+ $this->t('The field %field_name is already translatable. No change was performed.', $t_args):
+ $this->t('The field %field_name is already untranslatable. No change was performed.', $t_args);
drupal_set_message($msg, 'warning');
return;
}
+ $title = !$translatable ? $this->t('Enabling translation for the %field_name field', $t_args) : $this->t('Disabling translation for the %field_name field', $t_args);
+
// If a field is untranslatable, it can have no data except under
// Language::LANGCODE_NOT_SPECIFIED. Thus we need a field to be translatable
// before we convert data to the entity language. Conversely we need to
@@ -133,9 +135,6 @@ public function submitForm(array &$form, array &$form_state) {
);
$operations = $translatable ? $operations : array_reverse($operations);
- $t_args = array('%field' => $this->fieldName);
- $title = !$translatable ? t('Enabling translation for the %field field', $t_args) : t('Disabling translation for the %field field', $t_args);
-
$batch = array(
'title' => $title,
'operations' => $operations,