You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'#markup' => '<div>' . t("This example uses the entity_autocomplete form "
73
-
. "element to select users. You'll need a few users on your system for "
74
-
. "it to make sense.") . '</div>',
72
+
'#markup' => '<div>' . $this->t("This example uses the <code>entity_autocomplete</code> form element to select users. You'll need a few users on your system for it to make sense.") . '</div>',
75
73
];
76
74
77
75
// Here we use the delightful entity_autocomplete form element. It allows us
@@ -85,7 +83,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
85
83
// Specifying #tags as TRUE allows for multiple selections, separated by
86
84
// commas.
87
85
'#tags' => TRUE,
88
-
'#title' => t('Choose a user. Separate with commas.'),
86
+
'#title' => $this->t('Choose a user (Separate with commas)'),
Copy file name to clipboardexpand all lines: ajax_example/src/Form/Wizard.php
+3-3
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $no_js_us
37
37
// We want to deal with hierarchical form values.
38
38
$form['#tree'] = TRUE;
39
39
$form['description'] = [
40
-
'#markup' => t('This example is a step-by-step wizard. The @link does it without page reloads; the @link1 is the same code but simulates a non-javascript environment, showing it with page reloads.', [
40
+
'#markup' => $this->t('This example is a step-by-step wizard. The @link does it without page reloads; the @link1 is the same code but simulates a non-javascript environment, showing it with page reloads.', [
41
41
'@link' => $linktwo,
42
42
'@link1' => $link,
43
43
]),
@@ -155,7 +155,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
155
155
unset($form['next']);
156
156
$form['step2'] = [
157
157
'#type' => 'fieldset',
158
-
'#title' => t('Step 2: Street address info'),
158
+
'#title' => $this->t('Step 2: Street address info'),
159
159
];
160
160
$form['step2']['address'] = [
161
161
'#type' => 'textfield',
@@ -197,7 +197,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
197
197
if ($step > 1 && !isset($form['prev'])) {
198
198
$form['prev'] = [
199
199
'#type' => 'submit',
200
-
'#value' => t("Previous step"),
200
+
'#value' => $this->t("Previous step"),
201
201
// Since all info will be discarded, don't validate on 'prev'.
202
202
'#limit_validation_errors' => [],
203
203
// #submit is required to use #limit_validation_errors.
Copy file name to clipboardexpand all lines: batch_example/src/Form/BatchExampleForm.php
+10-10
Original file line number
Diff line number
Diff line change
@@ -24,14 +24,14 @@ public function buildForm(array $form, FormStateInterface $form_state) {
24
24
25
25
$form['description'] = [
26
26
'#type' => 'markup',
27
-
'#markup' => t('This example offers two different batches. The first does 1000 identical operations, each completed in on run; the second does 20 operations, but each takes more than one run to operate if there are more than 5 nodes.'),
27
+
'#markup' => $this->t('This example offers two different batches. The first does 1000 identical operations, each completed in on run; the second does 20 operations, but each takes more than one run to operate if there are more than 5 nodes.'),
@@ -46,16 +52,15 @@ public function entryAdvancedList() {
46
52
$content = [];
47
53
48
54
$content['message'] = [
49
-
'#markup' => $this->t('A more complex list of entries in the database.') . '' .
50
-
$this->t('Only the entries with name = "John" and age older than 18 years are shown, the username of the person who created the entry is also shown.'),
55
+
'#markup' => $this->t('A more complex list of entries in the database. Only the entries with name = "John" and age older than 18 years are shown, the username of the person who created the entry is also shown.'),
51
56
];
52
57
53
58
$headers = [
54
-
t('Id'),
55
-
t('Created by'),
56
-
t('Name'),
57
-
t('Surname'),
58
-
t('Age'),
59
+
$this->t('Id'),
60
+
$this->t('Created by'),
61
+
$this->t('Name'),
62
+
$this->t('Surname'),
63
+
$this->t('Age'),
59
64
];
60
65
61
66
$rows = [];
@@ -68,7 +73,7 @@ public function entryAdvancedList() {
0 commit comments