diff -u b/core/modules/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php --- b/core/modules/system/src/Form/ModulesListForm.php +++ b/core/modules/system/src/Form/ModulesListForm.php @@ -247,8 +247,8 @@ protected function buildRow(array $modules, Extension $module, $distribution) { // Set the basic properties. $row['#version'] = $module->info['version']; - $row['#requires'] = isset($row['#requires']) ? $row['#requires'] : FALSE; - $row['#required_by'] = isset($row['#required_by']) ? $row['#required_by'] : FALSE; + $row['#requires'] = array(); + $row['#required_by'] = array(); // Generate link for module's help page, if there is one. $row_links['help'] = array(); @@ -464,9 +464,9 @@ $row['description'] = array( '#type' => 'details', - '#title' => ' ' . $this->t($module->info['description']) . '', + '#title' => $this->t(' ' . $module->info['description'] . ''), '#attributes' => array('id' => $id . '-description'), - '#description' => $description, + '#description' => t($description), '#collapsed' => TRUE, '#wrapper_attributes' => array( 'class' => array('description', 'expand'), only in patch2: unchanged: --- a/core/lib/Drupal/Core/Access/AccessResultInterface.php +++ b/core/lib/Drupal/Core/Access/AccessResultInterface.php @@ -22,11 +22,6 @@ * @endcode * would never enter the else-statement and hence introduce a critical security * issue. - * - * Objects implementing this interface are using Kleene's weak three-valued - * logic with the isAllowed() state being TRUE, the isForbidden() state being - * the intermediate truth value and isNeutral() being FALSE. See - * http://en.wikipedia.org/wiki/Many-valued_logic for more. */ interface AccessResultInterface { @@ -65,6 +60,15 @@ public function isNeutral(); * - otherwise if isAllowed() in either ⇒ isAllowed() * - otherwise both must be isNeutral() ⇒ isNeutral() * + * Truth table: + * @code + * |A N F + * --+----- + * A |A A F + * N |A N F + * F |F F F + * @endcode + * * @param \Drupal\Core\Access\AccessResultInterface $other * The other access result to OR this one with. * @@ -80,6 +84,15 @@ public function orIf(AccessResultInterface $other); * - otherwise, if isAllowed() in both ⇒ isAllowed() * - otherwise, one of them is isNeutral() ⇒ isNeutral() * + * Truth table: + * @code + * |A N F + * --+----- + * A |A N F + * N |N N F + * F |F F F + * @endcode + * * @param \Drupal\Core\Access\AccessResultInterface $other * The other access result to AND this one with. * only in patch2: unchanged: --- a/core/modules/aggregator/src/Plugin/views/field/TitleLink.php +++ b/core/modules/aggregator/src/Plugin/views/field/TitleLink.php @@ -48,7 +48,7 @@ protected function defineOptions() { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['display_as_link'] = array( - '#title' => t('Display as link'), + '#title' => $this->t('Display as link'), '#type' => 'checkbox', '#default_value' => !empty($this->options['display_as_link']), ); only in patch2: unchanged: --- a/core/modules/aggregator/src/Plugin/views/row/Rss.php +++ b/core/modules/aggregator/src/Plugin/views/row/Rss.php @@ -55,12 +55,12 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['view_mode'] = array( '#type' => 'select', - '#title' => t('Display type'), + '#title' => $this->t('Display type'), '#options' => array( - 'fulltext' => t('Full text'), - 'teaser' => t('Title plus teaser'), - 'title' => t('Title only'), - 'default' => t('Use default RSS settings'), + 'fulltext' => $this->t('Full text'), + 'teaser' => $this->t('Title plus teaser'), + 'title' => $this->t('Title only'), + 'default' => $this->t('Use default RSS settings'), ), '#default_value' => $this->options['view_mode'], ); only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/argument/UserUid.php +++ b/core/modules/comment/src/Plugin/views/argument/UserUid.php @@ -62,7 +62,7 @@ function title() { $title = $this->database->query('SELECT name FROM {users_field_data} WHERE uid = :uid AND default_langcode = 1', array(':uid' => $this->argument))->fetchField(); } if (empty($title)) { - return t('No user'); + return $this->t('No user'); } return String::checkPlain($title); @@ -108,7 +108,7 @@ public function query($group_by = FALSE) { * {@inheritdoc} */ public function getSortName() { - return t('Numerical', array(), array('context' => 'Sort order')); + return $this->t('Numerical', array(), array('context' => 'Sort order')); } } only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/field/Comment.php +++ b/core/modules/comment/src/Plugin/views/field/Comment.php @@ -63,13 +63,13 @@ protected function defineOptions() { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_to_comment'] = array( - '#title' => t('Link this field to its comment'), - '#description' => t("Enable to override this field's links."), + '#title' => $this->t('Link this field to its comment'), + '#description' => $this->t("Enable to override this field's links."), '#type' => 'checkbox', '#default_value' => $this->options['link_to_comment'], ); $form['link_to_entity'] = array( - '#title' => t('Link field to the entity if there is no comment'), + '#title' => $this->t('Link field to the entity if there is no comment'), '#type' => 'checkbox', '#default_value' => $this->options['link_to_entity'], ); only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/field/EntityLink.php +++ b/core/modules/comment/src/Plugin/views/field/EntityLink.php @@ -36,9 +36,9 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['teaser'] = array( '#type' => 'checkbox', - '#title' => t('Show teaser-style link'), + '#title' => $this->t('Show teaser-style link'), '#default_value' => $this->options['teaser'], - '#description' => t('Show the comment link in the form used on standard entity teasers, rather than the full entity form.'), + '#description' => $this->t('Show the comment link in the form used on standard entity teasers, rather than the full entity form.'), ); parent::buildOptionsForm($form, $form_state); only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/field/Link.php +++ b/core/modules/comment/src/Plugin/views/field/Link.php @@ -73,7 +73,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#default_value' => $this->options['text'], ); $form['link_to_entity'] = array( - '#title' => t('Link field to the entity if there is no comment'), + '#title' => $this->t('Link field to the entity if there is no comment'), '#type' => 'checkbox', '#default_value' => $this->options['link_to_entity'], ); @@ -102,7 +102,7 @@ public function render(ResultRow $values) { * Returns a string for the link text. */ protected function renderLink($data, ResultRow $values) { - $text = !empty($this->options['text']) ? $this->options['text'] : t('View'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('View'); /** @var \Drupal\comment\CommentInterface $comment */ $comment = $data; $cid = $comment->id(); only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/field/LinkApprove.php +++ b/core/modules/comment/src/Plugin/views/field/LinkApprove.php @@ -47,7 +47,7 @@ protected function renderLink($data, ResultRow $values) { return; } - $text = !empty($this->options['text']) ? $this->options['text'] : t('Approve'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Approve'); $comment = $this->get_entity($values); $this->options['alter']['make_link'] = TRUE; only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/field/LinkDelete.php +++ b/core/modules/comment/src/Plugin/views/field/LinkDelete.php @@ -39,7 +39,7 @@ public function access(AccountInterface $account) { * Returns a string for the link text. */ protected function renderLink($data, ResultRow $values) { - $text = !empty($this->options['text']) ? $this->options['text'] : t('Delete'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Delete'); $comment = $this->getEntity($values); $this->options['alter']['make_link'] = TRUE; only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/field/LinkEdit.php +++ b/core/modules/comment/src/Plugin/views/field/LinkEdit.php @@ -31,8 +31,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['destination'] = array( '#type' => 'checkbox', - '#title' => t('Use destination'), - '#description' => t('Add destination to the link'), + '#title' => $this->t('Use destination'), + '#description' => $this->t('Add destination to the link'), '#default_value' => $this->options['destination'], ); } @@ -56,7 +56,7 @@ protected function renderLink($data, ResultRow $values) { return; } - $text = !empty($this->options['text']) ? $this->options['text'] : t('Edit'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit'); unset($this->options['alter']['fragment']); if (!empty($this->options['destination'])) { only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/field/LinkReply.php +++ b/core/modules/comment/src/Plugin/views/field/LinkReply.php @@ -39,7 +39,7 @@ public function access(AccountInterface $account) { * Returns a string for the link text. */ protected function renderLink($data, ResultRow $values) { - $text = !empty($this->options['text']) ? $this->options['text'] : t('Reply'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Reply'); $comment = $this->getEntity($values); $this->options['alter']['make_link'] = TRUE; only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/field/NodeComment.php +++ b/core/modules/comment/src/Plugin/views/field/NodeComment.php @@ -28,11 +28,11 @@ public function render(ResultRow $values) { switch ($value) { case CommentItemInterface::HIDDEN: default: - return t('Hidden'); + return $this->t('Hidden'); case CommentItemInterface::CLOSED: - return t('Closed'); + return $this->t('Closed'); case CommentItemInterface::OPEN: - return t('Open'); + return $this->t('Open'); } } only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php +++ b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php @@ -85,8 +85,8 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_to_comment'] = array( - '#title' => t('Link this field to new comments'), - '#description' => t("Enable to override this field's links."), + '#title' => $this->t('Link this field to new comments'), + '#description' => $this->t("Enable to override this field's links."), '#type' => 'checkbox', '#default_value' => $this->options['link_to_comment'], ); only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/field/Username.php +++ b/core/modules/comment/src/Plugin/views/field/Username.php @@ -42,7 +42,7 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_to_user'] = array( - '#title' => t("Link this field to its user or an author's homepage"), + '#title' => $this->t("Link this field to its user or an author's homepage"), '#type' => 'checkbox', '#default_value' => $this->options['link_to_user'], ); only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/filter/NodeComment.php +++ b/core/modules/comment/src/Plugin/views/filter/NodeComment.php @@ -21,9 +21,9 @@ class NodeComment extends InOperator { public function getValueOptions() { $this->value_options = array( - CommentItemInterface::HIDDEN => t('Hidden'), - CommentItemInterface::CLOSED => t('Closed'), - CommentItemInterface::OPEN => t('Open'), + CommentItemInterface::HIDDEN => $this->t('Hidden'), + CommentItemInterface::CLOSED => $this->t('Closed'), + CommentItemInterface::OPEN => $this->t('Open'), ); } only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/row/Rss.php +++ b/core/modules/comment/src/Plugin/views/row/Rss.php @@ -41,7 +41,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['view_mode'] = array( '#type' => 'select', - '#title' => t('Display type'), + '#title' => $this->t('Display type'), '#options' => $this->options_form_summary_options(), '#default_value' => $this->options['view_mode'], ); @@ -74,8 +74,8 @@ function options_form_summary_options() { foreach ($view_modes as $mode => $settings) { $options[$mode] = $settings['label']; } - $options['title'] = t('Title only'); - $options['default'] = t('Use site default RSS settings'); + $options['title'] = $this->t('Title only'); + $options['default'] = $this->t('Use site default RSS settings'); return $options; } only in patch2: unchanged: --- a/core/modules/comment/src/Plugin/views/wizard/Comment.php +++ b/core/modules/comment/src/Plugin/views/wizard/Comment.php @@ -69,8 +69,8 @@ class Comment extends WizardPluginBase { */ protected function rowStyleOptions() { $options = array(); - $options['comment'] = t('comments'); - $options['fields'] = t('fields'); + $options['comment'] = $this->t('comments'); + $options['fields'] = $this->t('fields'); return $options; } @@ -87,11 +87,11 @@ protected function buildFormStyle(array &$form, FormStateInterface $form_state, case 'comment': $style_form['row_options']['links'] = array( '#type' => 'select', - '#title' => t('Should links be displayed below each comment'), + '#title' => $this->t('Should links be displayed below each comment'), '#title_display' => 'invisible', '#options' => array( - 1 => t('with links (allow users to reply to the comment, etc.)'), - 0 => t('without links'), + 1 => $this->t('with links (allow users to reply to the comment, etc.)'), + 0 => $this->t('without links'), ), '#default_value' => 1, ); only in patch2: unchanged: --- a/core/modules/contact/src/Plugin/views/field/ContactLink.php +++ b/core/modules/contact/src/Plugin/views/field/ContactLink.php @@ -87,9 +87,9 @@ public static function create(ContainerInterface $container, array $configuratio */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); - $form['text']['#title'] = t('Link label'); + $form['text']['#title'] = $this->t('Link label'); $form['text']['#required'] = TRUE; - $form['text']['#default_value'] = empty($this->options['text']) ? t('contact') : $this->options['text']; + $form['text']['#default_value'] = empty($this->options['text']) ? $this->t('contact') : $this->options['text']; } /** @@ -119,7 +119,7 @@ protected function renderLink(EntityInterface $entity, ResultRow $values) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "user/{$entity->id()}/contact"; - $title = t('Contact %user', array('%user' => $entity->name->value)); + $title = $this->t('Contact %user', array('%user' => $entity->name->value)); $this->options['alter']['attributes'] = array('title' => $title); if (!empty($this->options['text'])) { only in patch2: unchanged: --- a/core/modules/content_translation/src/Plugin/views/field/TranslationLink.php +++ b/core/modules/content_translation/src/Plugin/views/field/TranslationLink.php @@ -36,7 +36,7 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['text'] = array( '#type' => 'textfield', - '#title' => t('Text to display'), + '#title' => $this->t('Text to display'), '#default_value' => $this->options['text'], ); parent::buildOptionsForm($form, $form_state); @@ -62,7 +62,7 @@ public function render(ResultRow $values) { */ protected function renderLink(EntityInterface $entity, ResultRow $values) { if (content_translation_translate_access($entity)->isAllowed()) { - $text = !empty($this->options['text']) ? $this->options['text'] : t('Translate'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Translate'); $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = $entity->getSystemPath('drupal:content-translation-overview'); only in patch2: unchanged: --- a/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php +++ b/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php @@ -44,18 +44,18 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $field_options = array_slice($all_fields, 0, array_search($this->options['id'], array_keys($all_fields))); $form['fields'] = array( '#type' => 'checkboxes', - '#title' => t('Fields'), - '#description' => t('Fields to be included as contextual links.'), + '#title' => $this->t('Fields'), + '#description' => $this->t('Fields to be included as contextual links.'), '#options' => $field_options, '#default_value' => $this->options['fields'], ); $form['destination'] = array( '#type' => 'select', - '#title' => t('Include destination'), - '#description' => t('Include a "destination" parameter in the link to return the user to the original view upon completing the contextual action.'), + '#title' => $this->t('Include destination'), + '#description' => $this->t('Include a "destination" parameter in the link to return the user to the original view upon completing the contextual action.'), '#options' => array( - '0' => t('No'), - '1' => t('Yes'), + '0' => $this->t('No'), + '1' => $this->t('Yes'), ), '#default_value' => $this->options['destination'], ); only in patch2: unchanged: --- a/core/modules/dblog/src/Plugin/views/field/DblogMessage.php +++ b/core/modules/dblog/src/Plugin/views/field/DblogMessage.php @@ -51,7 +51,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['replace_variables'] = array( - '#title' => t('Replace variables'), + '#title' => $this->t('Replace variables'), '#type' => 'checkbox', '#default_value' => $this->options['replace_variables'], ); only in patch2: unchanged: --- a/core/modules/entity_reference/src/Plugin/views/display/EntityReference.php +++ b/core/modules/entity_reference/src/Plugin/views/display/EntityReference.php @@ -165,14 +165,14 @@ public function validate() { // Verify that search fields are set up. $style = $this->getOption('style'); if (!isset($style['options']['search_fields'])) { - $errors[] = t('Display "@display" needs a selected search fields to work properly. See the settings for the Entity Reference list format.', array('@display' => $this->display['display_title'])); + $errors[] = $this->t('Display "@display" needs a selected search fields to work properly. See the settings for the Entity Reference list format.', array('@display' => $this->display['display_title'])); } else { // Verify that the search fields used actually exist. $fields = array_keys($this->handlers['field']); foreach ($style['options']['search_fields'] as $field_alias => $enabled) { if ($enabled && !in_array($field_alias, $fields)) { - $errors[] = t('Display "@display" uses field %field as search field, but the field is no longer present. See the settings for the Entity Reference list format.', array('@display' => $this->display['display_title'], '%field' => $field_alias)); + $errors[] = $this->t('Display "@display" uses field %field as search field, but the field is no longer present. See the settings for the Entity Reference list format.', array('@display' => $this->display['display_title'], '%field' => $field_alias)); } } } only in patch2: unchanged: --- a/core/modules/entity_reference/src/Plugin/views/row/EntityReference.php +++ b/core/modules/entity_reference/src/Plugin/views/row/EntityReference.php @@ -43,7 +43,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); // Expand the description of the 'Inline field' checkboxes. - $form['inline']['#description'] .= '
' . t("Note: In 'Entity Reference' displays, all fields will be displayed inline unless an explicit selection of inline fields is made here." ); + $form['inline']['#description'] .= '
' . $this->t("Note: In 'Entity Reference' displays, all fields will be displayed inline unless an explicit selection of inline fields is made here." ); } /** only in patch2: unchanged: --- a/core/modules/entity_reference/src/Plugin/views/style/EntityReference.php +++ b/core/modules/entity_reference/src/Plugin/views/style/EntityReference.php @@ -61,11 +61,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $options = $this->displayHandler->getFieldLabels(TRUE); $form['search_fields'] = array( '#type' => 'checkboxes', - '#title' => t('Search fields'), + '#title' => $this->t('Search fields'), '#options' => $options, '#required' => TRUE, '#default_value' => $this->options['search_fields'], - '#description' => t('Select the field(s) that will be searched when using the autocomplete widget.'), + '#description' => $this->t('Select the field(s) that will be searched when using the autocomplete widget.'), '#weight' => -3, ); } only in patch2: unchanged: --- a/core/modules/field/src/Plugin/views/argument/FieldList.php +++ b/core/modules/field/src/Plugin/views/argument/FieldList.php @@ -55,7 +55,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['summary']['human'] = array( - '#title' => t('Display list value as human readable'), + '#title' => $this->t('Display list value as human readable'), '#type' => 'checkbox', '#default_value' => $this->options['summary']['human'], '#states' => array( only in patch2: unchanged: --- a/core/modules/field/src/Plugin/views/argument/ListString.php +++ b/core/modules/field/src/Plugin/views/argument/ListString.php @@ -56,7 +56,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['summary']['human'] = array( - '#title' => t('Display list value as human readable'), + '#title' => $this->t('Display list value as human readable'), '#type' => 'checkbox', '#default_value' => $this->options['summary']['human'], '#states' => array( only in patch2: unchanged: --- a/core/modules/field/src/Plugin/views/field/Field.php +++ b/core/modules/field/src/Plugin/views/field/Field.php @@ -459,16 +459,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { else { $form['click_sort_column'] = array( '#type' => 'select', - '#title' => t('Column used for click sorting'), + '#title' => $this->t('Column used for click sorting'), '#options' => array_combine($column_names, $column_names), '#default_value' => $this->options['click_sort_column'], - '#description' => t('Used by Style: Table to determine the actual column to click sort the field on. The default is usually fine.'), + '#description' => $this->t('Used by Style: Table to determine the actual column to click sort the field on. The default is usually fine.'), ); } $form['type'] = array( '#type' => 'select', - '#title' => t('Formatter'), + '#title' => $this->t('Formatter'), '#options' => $formatters, '#default_value' => $this->options['type'], '#ajax' => array( @@ -479,16 +479,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['field_api_classes'] = array( - '#title' => t('Use field template'), + '#title' => $this->t('Use field template'), '#type' => 'checkbox', '#default_value' => $this->options['field_api_classes'], - '#description' => t('If checked, field api classes will be added by field templates. This is not recommended unless your CSS depends upon these classes. If not checked, template will not be used.'), + '#description' => $this->t('If checked, field api classes will be added by field templates. This is not recommended unless your CSS depends upon these classes. If not checked, template will not be used.'), '#fieldset' => 'style_settings', '#weight' => 20, ); if ($this->multiple) { - $form['field_api_classes']['#description'] .= ' ' . t('Checking this option will cause the group Display Type and Separator values to be ignored.'); + $form['field_api_classes']['#description'] .= ' ' . $this->t('Checking this option will cause the group Display Type and Separator values to be ignored.'); } // Get the currently selected formatter. @@ -523,21 +523,21 @@ function multiple_options_form(&$form, FormStateInterface $form_state) { $form['multiple_field_settings'] = array( '#type' => 'details', - '#title' => t('Multiple field settings'), + '#title' => $this->t('Multiple field settings'), '#weight' => 5, ); $form['group_rows'] = array( - '#title' => t('Display all values in the same row'), + '#title' => $this->t('Display all values in the same row'), '#type' => 'checkbox', '#default_value' => $this->options['group_rows'], - '#description' => t('If checked, multiple values for this field will be shown in the same row. If not checked, each value in this field will create a new row. If using group by, please make sure to group by "Entity ID" for this setting to have any effect.'), + '#description' => $this->t('If checked, multiple values for this field will be shown in the same row. If not checked, each value in this field will create a new row. If using group by, please make sure to group by "Entity ID" for this setting to have any effect.'), '#fieldset' => 'multiple_field_settings', ); // Make the string translatable by keeping it as a whole rather than // translating prefix and suffix separately. - list($prefix, $suffix) = explode('@count', t('Display @count value(s)')); + list($prefix, $suffix) = explode('@count', $this->t('Display @count value(s)')); if ($field->getCardinality() == FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) { $type = 'textfield'; @@ -552,11 +552,11 @@ function multiple_options_form(&$form, FormStateInterface $form_state) { } $form['multi_type'] = array( '#type' => 'radios', - '#title' => t('Display type'), + '#title' => $this->t('Display type'), '#options' => array( - 'ul' => t('Unordered list'), - 'ol' => t('Ordered list'), - 'separator' => t('Simple separator'), + 'ul' => $this->t('Unordered list'), + 'ol' => $this->t('Ordered list'), + 'separator' => $this->t('Simple separator'), ), '#states' => array( 'visible' => array( @@ -569,7 +569,7 @@ function multiple_options_form(&$form, FormStateInterface $form_state) { $form['separator'] = array( '#type' => 'textfield', - '#title' => t('Separator'), + '#title' => $this->t('Separator'), '#default_value' => $this->options['separator'], '#states' => array( 'visible' => array( @@ -596,7 +596,7 @@ function multiple_options_form(&$form, FormStateInterface $form_state) { '#fieldset' => 'multiple_field_settings', ); - list($prefix, $suffix) = explode('@count', t('starting from @count')); + list($prefix, $suffix) = explode('@count', $this->t('starting from @count')); $form['delta_offset'] = array( '#type' => 'textfield', '#size' => 5, @@ -608,11 +608,11 @@ function multiple_options_form(&$form, FormStateInterface $form_state) { ':input[name="options[group_rows]"]' => array('checked' => TRUE), ), ), - '#description' => t('(first item is 0)'), + '#description' => $this->t('(first item is 0)'), '#fieldset' => 'multiple_field_settings', ); $form['delta_reversed'] = array( - '#title' => t('Reversed'), + '#title' => $this->t('Reversed'), '#type' => 'checkbox', '#default_value' => $this->options['delta_reversed'], '#suffix' => $suffix, @@ -621,11 +621,11 @@ function multiple_options_form(&$form, FormStateInterface $form_state) { ':input[name="options[group_rows]"]' => array('checked' => TRUE), ), ), - '#description' => t('(start from last values)'), + '#description' => $this->t('(start from last values)'), '#fieldset' => 'multiple_field_settings', ); $form['delta_first_last'] = array( - '#title' => t('First and last only'), + '#title' => $this->t('First and last only'), '#type' => 'checkbox', '#default_value' => $this->options['delta_first_last'], '#suffix' => '', @@ -648,14 +648,14 @@ public function buildGroupByForm(&$form, FormStateInterface $form_state) { $field_columns = array_keys($this->getFieldDefinition()->getColumns()); $group_columns = array( - 'entity_id' => t('Entity ID'), + 'entity_id' => $this->t('Entity ID'), ) + array_map('ucfirst', array_combine($field_columns, $field_columns)); $form['group_column'] = array( '#type' => 'select', - '#title' => t('Group column'), + '#title' => $this->t('Group column'), '#default_value' => $this->options['group_column'], - '#description' => t('Select the column of this field to apply the grouping function selected above.'), + '#description' => $this->t('Select the column of this field to apply the grouping function selected above.'), '#options' => $group_columns, ); @@ -667,9 +667,9 @@ public function buildGroupByForm(&$form, FormStateInterface $form_state) { // Add on defined fields, noting that they're prefixed with the field name. $form['group_columns'] = array( '#type' => 'checkboxes', - '#title' => t('Group columns (additional)'), + '#title' => $this->t('Group columns (additional)'), '#default_value' => $this->options['group_columns'], - '#description' => t('Select any additional columns of this field to include in the query and to group on.'), + '#description' => $this->t('Select any additional columns of this field to include in the query and to group on.'), '#options' => $options + $group_columns, ); } @@ -889,7 +889,7 @@ function render_item($count, $item) { protected function documentSelfTokens(&$tokens) { $field = $this->getFieldDefinition(); foreach ($field->getColumns() as $id => $column) { - $tokens['[' . $this->options['id'] . '-' . $id . ']'] = t('Raw @column', array('@column' => $id)); + $tokens['[' . $this->options['id'] . '-' . $id . ']'] = $this->t('Raw @column', array('@column' => $id)); } } only in patch2: unchanged: --- a/core/modules/file/src/Plugin/views/field/Extension.php +++ b/core/modules/file/src/Plugin/views/field/Extension.php @@ -36,8 +36,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['extension_detect_tar'] = array( '#type' => 'checkbox', - '#title' => t('Detect if tar is part of the extension'), - '#description' => t("See if the previous extension is '.tar' and if so, add that, so we see 'tar.gz' or 'tar.bz2' instead of just 'gz'."), + '#title' => $this->t('Detect if tar is part of the extension'), + '#description' => $this->t("See if the previous extension is '.tar' and if so, add that, so we see 'tar.gz' or 'tar.bz2' instead of just 'gz'."), '#default_value' => $this->options['extension_detect_tar'], ); } only in patch2: unchanged: --- a/core/modules/file/src/Plugin/views/field/File.php +++ b/core/modules/file/src/Plugin/views/field/File.php @@ -44,8 +44,8 @@ protected function defineOptions() { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_to_file'] = array( - '#title' => t('Link this field to download the file'), - '#description' => t("Enable to override this field's links."), + '#title' => $this->t('Link this field to download the file'), + '#description' => $this->t("Enable to override this field's links."), '#type' => 'checkbox', '#default_value' => !empty($this->options['link_to_file']), ); only in patch2: unchanged: --- a/core/modules/file/src/Plugin/views/field/FileMime.php +++ b/core/modules/file/src/Plugin/views/field/FileMime.php @@ -27,7 +27,7 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['filemime_image'] = array( - '#title' => t('Display an icon representing the file type, instead of the MIME text (such as "image/jpeg")'), + '#title' => $this->t('Display an icon representing the file type, instead of the MIME text (such as "image/jpeg")'), '#type' => 'checkbox', '#default_value' => !empty($this->options['filemime_image']), ); only in patch2: unchanged: --- a/core/modules/file/src/Plugin/views/field/Uri.php +++ b/core/modules/file/src/Plugin/views/field/Uri.php @@ -25,8 +25,8 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['file_download_path'] = array( - '#title' => t('Display download path instead of file storage URI'), - '#description' => t('This will provide the full download URL rather than the internal filestream address.'), + '#title' => $this->t('Display download path instead of file storage URI'), + '#description' => $this->t('This will provide the full download URL rather than the internal filestream address.'), '#type' => 'checkbox', '#default_value' => !empty($this->options['file_download_path']), ); only in patch2: unchanged: --- a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php +++ b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php @@ -60,7 +60,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { if (\Drupal::moduleHandler()->moduleExists('comment')) { $form['comments'] = array( '#type' => 'checkbox', - '#title' => t('Check for new comments as well'), + '#title' => $this->t('Check for new comments as well'), '#default_value' => !empty($this->options['comments']), ); } only in patch2: unchanged: --- a/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php +++ b/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php @@ -49,7 +49,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { $label = $this->options['expose']['label']; } else { - $label = t('Has new content'); + $label = $this->t('Has new content'); } $form['value'] = array( '#type' => 'checkbox', @@ -95,7 +95,7 @@ public function query() { public function adminSummary() { if (!empty($this->options['exposed'])) { - return t('exposed'); + return $this->t('exposed'); } } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/argument/Type.php +++ b/core/modules/node/src/Plugin/views/argument/Type.php @@ -35,7 +35,7 @@ function title() { function node_type($type_name) { $type = entity_load('node_type', $type_name); - $output = $type ? $type->label() : t('Unknown content type'); + $output = $type ? $type->label() : $this->t('Unknown content type'); return UtilityString::checkPlain($output); } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/Language.php +++ b/core/modules/node/src/Plugin/views/field/Language.php @@ -30,10 +30,10 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['native_language'] = array( - '#title' => t('Native language'), + '#title' => $this->t('Native language'), '#type' => 'checkbox', '#default_value' => $this->options['native_language'], - '#description' => t('If enabled, the native name of the language will be displayed'), + '#description' => $this->t('If enabled, the native name of the language will be displayed'), ); } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/Link.php +++ b/core/modules/node/src/Plugin/views/field/Link.php @@ -36,7 +36,7 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['text'] = array( '#type' => 'textfield', - '#title' => t('Text to display'), + '#title' => $this->t('Text to display'), '#default_value' => $this->options['text'], ); parent::buildOptionsForm($form, $form_state); @@ -77,7 +77,7 @@ protected function renderLink($node, ResultRow $values) { if ($node->access('view')) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = 'node/' . $node->id(); - $text = !empty($this->options['text']) ? $this->options['text'] : t('View'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('View'); return $text; } } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/LinkDelete.php +++ b/core/modules/node/src/Plugin/views/field/LinkDelete.php @@ -40,7 +40,7 @@ protected function renderLink($node, ResultRow $values) { $this->options['alter']['path'] = $node->getSystemPath('delete-form'); $this->options['alter']['query'] = drupal_get_destination(); - $text = !empty($this->options['text']) ? $this->options['text'] : t('Delete'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Delete'); return $text; } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/LinkEdit.php +++ b/core/modules/node/src/Plugin/views/field/LinkEdit.php @@ -40,7 +40,7 @@ protected function renderLink($node, ResultRow $values) { $this->options['alter']['path'] = "node/" . $node->id() . "/edit"; $this->options['alter']['query'] = drupal_get_destination(); - $text = !empty($this->options['text']) ? $this->options['text'] : t('Edit'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit'); return $text; } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/Node.php +++ b/core/modules/node/src/Plugin/views/field/Node.php @@ -47,8 +47,8 @@ protected function defineOptions() { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_to_node'] = array( - '#title' => t('Link this field to the original piece of content'), - '#description' => t("Enable to override this field's links."), + '#title' => $this->t('Link this field to the original piece of content'), + '#description' => $this->t("Enable to override this field's links."), '#type' => 'checkbox', '#default_value' => !empty($this->options['link_to_node']), ); only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/NodeBulkForm.php +++ b/core/modules/node/src/Plugin/views/field/NodeBulkForm.php @@ -21,7 +21,7 @@ class NodeBulkForm extends BulkForm { * {@inheritdoc} */ protected function emptySelectedMessage() { - return t('No content selected.'); + return $this->t('No content selected.'); } } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/Path.php +++ b/core/modules/node/src/Plugin/views/field/Path.php @@ -42,9 +42,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['absolute'] = array( '#type' => 'checkbox', - '#title' => t('Use absolute link (begins with "http://")'), + '#title' => $this->t('Use absolute link (begins with "http://")'), '#default_value' => $this->options['absolute'], - '#description' => t('Enable this option to output an absolute link. Required if you want to use the path as a link destination (as in "output this field as a link" above).'), + '#description' => $this->t('Enable this option to output an absolute link. Required if you want to use the path as a link destination (as in "output this field as a link" above).'), '#fieldset' => 'alter', ); } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/Revision.php +++ b/core/modules/node/src/Plugin/views/field/Revision.php @@ -44,8 +44,8 @@ protected function defineOptions() { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_to_node_revision'] = array( - '#title' => t('Link this field to its content revision'), - '#description' => t('This will override any other link you have set.'), + '#title' => $this->t('Link this field to its content revision'), + '#description' => $this->t('This will override any other link you have set.'), '#type' => 'checkbox', '#default_value' => !empty($this->options['link_to_node_revision']), ); only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/RevisionLink.php +++ b/core/modules/node/src/Plugin/views/field/RevisionLink.php @@ -65,7 +65,7 @@ protected function renderLink($data, ResultRow $values) { $this->options['alter']['path'] = $path; $this->options['alter']['query'] = drupal_get_destination(); - return !empty($this->options['text']) ? $this->options['text'] : t('View'); + return !empty($this->options['text']) ? $this->options['text'] : $this->t('View'); } /** only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php +++ b/core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php @@ -53,7 +53,7 @@ protected function renderLink($data, ResultRow $values) { $this->options['alter']['path'] = 'node/' . $node->id() . "/revisions/$vid/delete"; $this->options['alter']['query'] = drupal_get_destination(); - return !empty($this->options['text']) ? $this->options['text'] : t('Delete'); + return !empty($this->options['text']) ? $this->options['text'] : $this->t('Delete'); } } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php +++ b/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php @@ -53,7 +53,7 @@ protected function renderLink($data, ResultRow $values) { $this->options['alter']['path'] = 'node/' . $node->id() . "/revisions/$vid/revert"; $this->options['alter']['query'] = drupal_get_destination(); - return !empty($this->options['text']) ? $this->options['text'] : t('Revert'); + return !empty($this->options['text']) ? $this->options['text'] : $this->t('Revert'); } } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/field/Type.php +++ b/core/modules/node/src/Plugin/views/field/Type.php @@ -34,8 +34,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['machine_name'] = array( - '#title' => t('Output machine name'), - '#description' => t('Display field as the content type machine name.'), + '#title' => $this->t('Output machine name'), + '#description' => $this->t('Display field as the content type machine name.'), '#type' => 'checkbox', '#default_value' => !empty($this->options['machine_name']), ); @@ -47,7 +47,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { function render_name($data, $values) { if ($this->options['machine_name'] != 1 && $data !== NULL && $data !== '') { $type = entity_load('node_type', $data); - return $type ? t($this->sanitizeValue($type->label())) : ''; + return $type ? $this->t($this->sanitizeValue($type->label())) : ''; } return $this->sanitizeValue($data); } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/row/Rss.php +++ b/core/modules/node/src/Plugin/views/row/Rss.php @@ -49,7 +49,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['view_mode'] = array( '#type' => 'select', - '#title' => t('Display type'), + '#title' => $this->t('Display type'), '#options' => $this->buildOptionsForm_summary_options(), '#default_value' => $this->options['view_mode'], ); @@ -64,8 +64,8 @@ public function buildOptionsForm_summary_options() { foreach ($view_modes as $mode => $settings) { $options[$mode] = $settings['label']; } - $options['title'] = t('Title only'); - $options['default'] = t('Use site default RSS settings'); + $options['title'] = $this->t('Title only'); + $options['default'] = $this->t('Use site default RSS settings'); return $options; } only in patch2: unchanged: --- a/core/modules/node/src/Plugin/views/wizard/Node.php +++ b/core/modules/node/src/Plugin/views/wizard/Node.php @@ -65,7 +65,7 @@ class Node extends WizardPluginBase { public function getAvailableSorts() { // You can't execute functions in properties, so override the method return array( - 'node_field_data-title:DESC' => t('Title') + 'node_field_data-title:DESC' => $this->t('Title') ); } @@ -74,11 +74,11 @@ public function getAvailableSorts() { */ protected function rowStyleOptions() { $options = array(); - $options['teasers'] = t('teasers'); - $options['full_posts'] = t('full posts'); - $options['titles'] = t('titles'); - $options['titles_linked'] = t('titles (linked)'); - $options['fields'] = t('fields'); + $options['teasers'] = $this->t('teasers'); + $options['full_posts'] = $this->t('full posts'); + $options['titles'] = $this->t('titles'); + $options['titles_linked'] = $this->t('titles (linked)'); + $options['fields'] = $this->t('fields'); return $options; } @@ -106,11 +106,11 @@ protected function buildFormStyle(array &$form, FormStateInterface $form_state, case 'teasers': $style_form['row_options']['links'] = array( '#type' => 'select', - '#title' => t('Should links be displayed below each node'), + '#title' => $this->t('Should links be displayed below each node'), '#title_display' => 'invisible', '#options' => array( - 1 => t('with links (allow users to add comments, etc.)'), - 0 => t('without links'), + 1 => $this->t('with links (allow users to add comments, etc.)'), + 0 => $this->t('without links'), ), '#default_value' => 1, ); @@ -297,7 +297,7 @@ protected function buildFilters(&$form, FormStateInterface $form_state) { // Add the autocomplete textfield to the wizard. $form['displays']['show']['tagged_with'] = array( '#type' => 'textfield', - '#title' => t('tagged with'), + '#title' => $this->t('tagged with'), '#autocomplete_route_name' => 'taxonomy.autocomplete', '#autocomplete_route_parameters' => array( 'entity_type' => $this->entityTypeId, only in patch2: unchanged: --- a/core/modules/rest/src/Plugin/views/display/RestExport.php +++ b/core/modules/rest/src/Plugin/views/display/RestExport.php @@ -225,7 +225,7 @@ public function optionsSummary(&$categories, &$options) { unset($options['show_admin_links'], $options['analyze-theme']); $categories['path'] = array( - 'title' => t('Path settings'), + 'title' => $this->t('Path settings'), 'column' => 'second', 'build' => array( '#weight' => -10, @@ -233,7 +233,7 @@ public function optionsSummary(&$categories, &$options) { ); $options['path']['category'] = 'path'; - $options['path']['title'] = t('Path'); + $options['path']['title'] = $this->t('Path'); // Remove css/exposed form settings, as they are not used for the data // display. only in patch2: unchanged: --- a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php +++ b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php @@ -79,8 +79,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['field_options'] = array( '#type' => 'table', - '#header' => array(t('Field'), t('Alias'), t('Raw output')), - '#empty' => t('You have no fields. Add some to your view.'), + '#header' => array(t('Field'), $this->t('Alias'), $this->t('Raw output')), + '#empty' => $this->t('You have no fields. Add some to your view.'), '#tree' => TRUE, ); @@ -92,14 +92,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#markup' => $id, ); $form['field_options'][$id]['alias'] = array( - '#title' => t('Alias for @id', array('@id' => $id)), + '#title' => $this->t('Alias for @id', array('@id' => $id)), '#title_display' => 'invisible', '#type' => 'textfield', '#default_value' => isset($options[$id]['alias']) ? $options[$id]['alias'] : '', '#element_validate' => array(array($this, 'validateAliasName')), ); $form['field_options'][$id]['raw_output'] = array( - '#title' => t('Raw output for @id', array('@id' => $id)), + '#title' => $this->t('Raw output for @id', array('@id' => $id)), '#title_display' => 'invisible', '#type' => 'checkbox', '#default_value' => isset($options[$id]['raw_output']) ? $options[$id]['raw_output'] : '', @@ -113,7 +113,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { */ public function validateAliasName($element, FormStateInterface $form_state) { if (preg_match('@[^A-Za-z0-9_-]+@', $element['#value'])) { - $form_state->setError($element, t('The machine-readable name must contain only letters, numbers, dashes and underscores.')); + $form_state->setError($element, $this->t('The machine-readable name must contain only letters, numbers, dashes and underscores.')); } } @@ -127,7 +127,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { // If array filter returns empty, no values have been entered. Unique keys // should only be validated if we have some. if (($filtered = array_filter($aliases)) && (array_unique($filtered) !== $filtered)) { - $form_state->setErrorByName('aliases', t('All field aliases must be unique')); + $form_state->setErrorByName('aliases', $this->t('All field aliases must be unique')); } } only in patch2: unchanged: --- a/core/modules/rest/src/Plugin/views/style/Serializer.php +++ b/core/modules/rest/src/Plugin/views/style/Serializer.php @@ -94,8 +94,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['formats'] = array( '#type' => 'checkboxes', - '#title' => t('Accepted request formats'), - '#description' => t('Request formats that will be allowed in responses. If none are selected all formats will be allowed.'), + '#title' => $this->t('Accepted request formats'), + '#description' => $this->t('Request formats that will be allowed in responses. If none are selected all formats will be allowed.'), '#options' => array_combine($this->formats, $this->formats), '#default_value' => $this->options['formats'], ); only in patch2: unchanged: --- a/core/modules/search/src/Plugin/views/filter/Search.php +++ b/core/modules/search/src/Plugin/views/filter/Search.php @@ -74,7 +74,7 @@ protected function defineOptions() { protected function operatorForm(&$form, FormStateInterface $form_state) { $form['operator'] = array( '#type' => 'radios', - '#title' => t('On empty input'), + '#title' => $this->t('On empty input'), '#default_value' => $this->operator, '#options' => array( 'optional' => $this->t('Show All'), only in patch2: unchanged: --- a/core/modules/search/src/Plugin/views/row/SearchRow.php +++ b/core/modules/search/src/Plugin/views/row/SearchRow.php @@ -38,7 +38,7 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['score'] = array( '#type' => 'checkbox', - '#title' => t('Display score'), + '#title' => $this->t('Display score'), '#default_value' => $this->options['score'], ); } only in patch2: unchanged: --- a/core/modules/system/src/Plugin/views/field/BulkForm.php +++ b/core/modules/system/src/Plugin/views/field/BulkForm.php @@ -96,23 +96,23 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['action_title'] = array( '#type' => 'textfield', - '#title' => t('Action title'), + '#title' => $this->t('Action title'), '#default_value' => $this->options['action_title'], - '#description' => t('The title shown above the actions dropdown.'), + '#description' => $this->t('The title shown above the actions dropdown.'), ); $form['include_exclude'] = array( '#type' => 'radios', - '#title' => t('Available actions'), + '#title' => $this->t('Available actions'), '#options' => array( - 'exclude' => t('All actions, except selected'), - 'include' => t('Only selected actions'), + 'exclude' => $this->t('All actions, except selected'), + 'include' => $this->t('Only selected actions'), ), '#default_value' => $this->options['include_exclude'], ); $form['selected_actions'] = array( '#type' => 'checkboxes', - '#title' => t('Selected actions'), + '#title' => $this->t('Selected actions'), '#options' => $this->getBulkOptions(FALSE), '#default_value' => $this->options['selected_actions'], ); @@ -175,14 +175,14 @@ public function viewsForm(&$form, FormStateInterface $form_state) { '#type' => 'checkbox', // We are not able to determine a main "title" for each row, so we can // only output a generic label. - '#title' => t('Update this item'), + '#title' => $this->t('Update this item'), '#title_display' => 'invisible', '#default_value' => !empty($form_state->getValue($this->options['id'])[$row_index]) ? 1 : NULL, ); } // Replace the form submit button label. - $form['actions']['submit']['#value'] = t('Apply'); + $form['actions']['submit']['#value'] = $this->t('Apply'); // Ensure a consistent container for filters/operations in the view header. $form['header'] = array( @@ -285,7 +285,7 @@ public function viewsFormSubmit(&$form, FormStateInterface $form_state) { * Message displayed when no items are selected. */ protected function emptySelectedMessage() { - return t('No items selected.'); + return $this->t('No items selected.'); } /** only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php @@ -36,15 +36,15 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['depth'] = array( '#type' => 'weight', - '#title' => t('Depth'), + '#title' => $this->t('Depth'), '#default_value' => $this->options['depth'], - '#description' => t('The depth will match nodes tagged with terms in the hierarchy. For example, if you have the term "fruit" and a child term "apple", with a depth of 1 (or higher) then filtering for the term "fruit" will get nodes that are tagged with "apple" as well as "fruit". If negative, the reverse is true; searching for "apple" will also pick up nodes tagged with "fruit" if depth is -1 (or lower).'), + '#description' => $this->t('The depth will match nodes tagged with terms in the hierarchy. For example, if you have the term "fruit" and a child term "apple", with a depth of 1 (or higher) then filtering for the term "fruit" will get nodes that are tagged with "apple" as well as "fruit". If negative, the reverse is true; searching for "apple" will also pick up nodes tagged with "fruit" if depth is -1 (or lower).'), ); $form['break_phrase'] = array( '#type' => 'checkbox', - '#title' => t('Allow multiple values'), - '#description' => t('If selected, users can enter multiple values in the form of 1+2+3. Due to the number of JOINs it would require, AND will be treated as OR with this filter.'), + '#title' => $this->t('Allow multiple values'), + '#description' => $this->t('If selected, users can enter multiple values in the form of 1+2+3. Due to the number of JOINs it would require, AND will be treated as OR with this filter.'), '#default_value' => !empty($this->options['break_phrase']), ); @@ -118,7 +118,7 @@ function title() { return String::checkPlain($term->getName()); } // TODO review text - return t('No name'); + return $this->t('No name'); } } only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php @@ -31,7 +31,7 @@ function title() { } } // TODO review text - return t('No name'); + return $this->t('No name'); } } only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/argument/VocabularyVid.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/VocabularyVid.php @@ -28,7 +28,7 @@ function title() { return String::checkPlain($vocabulary->label()); } - return t('No vocabulary'); + return $this->t('No vocabulary'); } } only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php +++ b/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php @@ -59,18 +59,18 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['term_page'] = array( '#type' => 'checkbox', - '#title' => t('Load default filter from term page'), + '#title' => $this->t('Load default filter from term page'), '#default_value' => $this->options['term_page'], ); $form['node'] = array( '#type' => 'checkbox', - '#title' => t('Load default filter from node page, that\'s good for related taxonomy blocks'), + '#title' => $this->t('Load default filter from node page, that\'s good for related taxonomy blocks'), '#default_value' => $this->options['node'], ); $form['limit'] = array( '#type' => 'checkbox', - '#title' => t('Limit terms by vocabulary'), + '#title' => $this->t('Limit terms by vocabulary'), '#default_value' => $this->options['limit'], '#states' => array( 'visible' => array( @@ -87,7 +87,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['vids'] = array( '#type' => 'checkboxes', - '#title' => t('Vocabularies'), + '#title' => $this->t('Vocabularies'), '#options' => $options, '#default_value' => $this->options['vids'], '#states' => array( @@ -100,11 +100,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['anyall'] = array( '#type' => 'radios', - '#title' => t('Multiple-value handling'), + '#title' => $this->t('Multiple-value handling'), '#default_value' => $this->options['anyall'], '#options' => array( - ',' => t('Filter to items that share all terms'), - '+' => t('Filter to items that share any term'), + ',' => $this->t('Filter to items that share all terms'), + '+' => $this->t('Filter to items that share any term'), ), '#states' => array( 'visible' => array( only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/argument_validator/TermName.php +++ b/core/modules/taxonomy/src/Plugin/views/argument_validator/TermName.php @@ -59,7 +59,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['transform'] = array( '#type' => 'checkbox', - '#title' => t('Transform dashes in URL to spaces in term name filter values'), + '#title' => $this->t('Transform dashes in URL to spaces in term name filter values'), '#default_value' => $this->options['transform'], ); } only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php +++ b/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php @@ -43,7 +43,7 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['text'] = array( '#type' => 'textfield', - '#title' => t('Text to display'), + '#title' => $this->t('Text to display'), '#default_value' => $this->options['text'], ); parent::buildOptionsForm($form, $form_state); @@ -67,7 +67,7 @@ public function render(ResultRow $values) { 'vid' => $values->{$this->aliases['vid']}, )); if ($term->access('update')) { - $text = !empty($this->options['text']) ? $this->options['text'] : t('Edit'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit'); return l($text, 'taxonomy/term/'. $tid . '/edit', array('query' => drupal_get_destination())); } } only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/field/Taxonomy.php +++ b/core/modules/taxonomy/src/Plugin/views/field/Taxonomy.php @@ -51,14 +51,14 @@ protected function defineOptions() { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_to_taxonomy'] = array( - '#title' => t('Link this field to its taxonomy term page'), - '#description' => t("Enable to override this field's links."), + '#title' => $this->t('Link this field to its taxonomy term page'), + '#description' => $this->t("Enable to override this field's links."), '#type' => 'checkbox', '#default_value' => !empty($this->options['link_to_taxonomy']), ); $form['convert_spaces'] = array( - '#title' => t('Convert spaces in term names to hyphens'), - '#description' => t('This allows links to work with Views taxonomy term arguments.'), + '#title' => $this->t('Convert spaces in term names to hyphens'), + '#description' => $this->t('This allows links to work with Views taxonomy term arguments.'), '#type' => 'checkbox', '#default_value' => !empty($this->options['convert_spaces']), ); only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php @@ -52,14 +52,14 @@ protected function defineOptions() { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_to_taxonomy'] = array( - '#title' => t('Link this field to its term page'), + '#title' => $this->t('Link this field to its term page'), '#type' => 'checkbox', '#default_value' => !empty($this->options['link_to_taxonomy']), ); $form['limit'] = array( '#type' => 'checkbox', - '#title' => t('Limit terms by vocabulary'), + '#title' => $this->t('Limit terms by vocabulary'), '#default_value' => $this->options['limit'], ); @@ -71,7 +71,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['vids'] = array( '#type' => 'checkboxes', - '#title' => t('Vocabularies'), + '#title' => $this->t('Vocabularies'), '#options' => $options, '#default_value' => $this->options['vids'], '#states' => array( @@ -130,10 +130,10 @@ function render_item($count, $item) { } protected function documentSelfTokens(&$tokens) { - $tokens['[' . $this->options['id'] . '-tid' . ']'] = t('The taxonomy term ID for the term.'); - $tokens['[' . $this->options['id'] . '-name' . ']'] = t('The taxonomy term name for the term.'); - $tokens['[' . $this->options['id'] . '-vocabulary-vid' . ']'] = t('The machine name for the vocabulary the term belongs to.'); - $tokens['[' . $this->options['id'] . '-vocabulary' . ']'] = t('The name for the vocabulary the term belongs to.'); + $tokens['[' . $this->options['id'] . '-tid' . ']'] = $this->t('The taxonomy term ID for the term.'); + $tokens['[' . $this->options['id'] . '-name' . ']'] = $this->t('The taxonomy term name for the term.'); + $tokens['[' . $this->options['id'] . '-vocabulary-vid' . ']'] = $this->t('The machine name for the vocabulary the term belongs to.'); + $tokens['[' . $this->options['id'] . '-vocabulary' . ']'] = $this->t('The name for the vocabulary the term belongs to.'); } protected function addSelfTokens(&$tokens, $item) { only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php @@ -71,9 +71,9 @@ public function buildExtraOptionsForm(&$form, FormStateInterface $form_state) { if (empty($this->definition['vocabulary'])) { $form['vid'] = array( '#type' => 'radios', - '#title' => t('Vocabulary'), + '#title' => $this->t('Vocabulary'), '#options' => $options, - '#description' => t('Select which vocabulary to show terms for in the regular options.'), + '#description' => $this->t('Select which vocabulary to show terms for in the regular options.'), '#default_value' => $this->options['vid'], ); } @@ -81,14 +81,14 @@ public function buildExtraOptionsForm(&$form, FormStateInterface $form_state) { $form['type'] = array( '#type' => 'radios', - '#title' => t('Selection type'), - '#options' => array('select' => t('Dropdown'), 'textfield' => t('Autocomplete')), + '#title' => $this->t('Selection type'), + '#options' => array('select' => $this->t('Dropdown'), 'textfield' => $this->t('Autocomplete')), '#default_value' => $this->options['type'], ); $form['hierarchy'] = array( '#type' => 'checkbox', - '#title' => t('Show hierarchy in dropdown'), + '#title' => $this->t('Show hierarchy in dropdown'), '#default_value' => !empty($this->options['hierarchy']), '#states' => array( 'visible' => array( @@ -102,7 +102,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { $vocabulary = entity_load('taxonomy_vocabulary', $this->options['vid']); if (empty($vocabulary) && $this->options['limit']) { $form['markup'] = array( - '#markup' => '
' . t('An invalid vocabulary is selected. Please change it in the options.') . '
', + '#markup' => '
' . $this->t('An invalid vocabulary is selected. Please change it in the options.') . '
', ); return; } @@ -120,7 +120,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { } $form['value'] = array( - '#title' => $this->options['limit'] ? t('Select terms from vocabulary @voc', array('@voc' => $vocabulary->label())) : t('Select terms'), + '#title' => $this->options['limit'] ? $this->t('Select terms from vocabulary @voc', array('@voc' => $vocabulary->label())) : $this->t('Select terms'), '#type' => 'textfield', '#default_value' => $default, ); @@ -193,7 +193,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { } $form['value'] = array( '#type' => 'select', - '#title' => $this->options['limit'] ? t('Select terms from vocabulary @voc', array('@voc' => $vocabulary->label())) : t('Select terms'), + '#title' => $this->options['limit'] ? $this->t('Select terms from vocabulary @voc', array('@voc' => $vocabulary->label())) : $this->t('Select terms'), '#multiple' => TRUE, '#options' => $options, '#size' => min(9, count($options)), @@ -342,7 +342,7 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { } $form['error_message'] = array( '#type' => 'checkbox', - '#title' => t('Display error message'), + '#title' => $this->t('Display error message'), '#default_value' => !empty($this->options['error_message']), ); } only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php +++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTidDepth.php @@ -23,7 +23,7 @@ class TaxonomyIndexTidDepth extends TaxonomyIndexTid { public function operatorOptions($which = 'title') { return array( - 'or' => t('Is one of'), + 'or' => $this->t('Is one of'), ); } @@ -40,9 +40,9 @@ public function buildExtraOptionsForm(&$form, FormStateInterface $form_state) { $form['depth'] = array( '#type' => 'weight', - '#title' => t('Depth'), + '#title' => $this->t('Depth'), '#default_value' => $this->options['depth'], - '#description' => t('The depth will match nodes tagged with terms in the hierarchy. For example, if you have the term "fruit" and a child term "apple", with a depth of 1 (or higher) then filtering for the term "fruit" will get nodes that are tagged with "apple" as well as "fruit". If negative, the reverse is true; searching for "apple" will also pick up nodes tagged with "fruit" if depth is -1 (or lower).'), + '#description' => $this->t('The depth will match nodes tagged with terms in the hierarchy. For example, if you have the term "fruit" and a child term "apple", with a depth of 1 (or higher) then filtering for the term "fruit" will get nodes that are tagged with "apple" as well as "fruit". If negative, the reverse is true; searching for "apple" will also pick up nodes tagged with "fruit" if depth is -1 (or lower).'), ); } only in patch2: unchanged: --- a/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php +++ b/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php @@ -54,10 +54,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['vids'] = array( '#type' => 'checkboxes', - '#title' => t('Vocabularies'), + '#title' => $this->t('Vocabularies'), '#options' => $options, '#default_value' => $this->options['vids'], - '#description' => t('Choose which vocabularies you wish to relate. Remember that every term found will create a new record, so this relationship is best used on just one vocabulary that has only one term per node.'), + '#description' => $this->t('Choose which vocabularies you wish to relate. Remember that every term found will create a new record, so this relationship is best used on just one vocabulary that has only one term per node.'), ); parent::buildOptionsForm($form, $form_state); } only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/access/Permission.php +++ b/core/modules/user/src/Plugin/views/access/Permission.php @@ -88,7 +88,7 @@ public function summaryTitle() { return $permissions[$this->options['perm']]['title']; } - return t($this->options['perm']); + return $this->t($this->options['perm']); } @@ -115,9 +115,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['perm'] = array( '#type' => 'select', '#options' => $perms, - '#title' => t('Permission'), + '#title' => $this->t('Permission'), '#default_value' => $this->options['perm'], - '#description' => t('Only users with the selected permission flag will be able to access this display. Note that users with "access all views" can see any view, regardless of other permissions.'), + '#description' => $this->t('Only users with the selected permission flag will be able to access this display. Note that users with "access all views" can see any view, regardless of other permissions.'), ); } only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/access/Role.php +++ b/core/modules/user/src/Plugin/views/access/Role.php @@ -50,10 +50,10 @@ public function alterRouteDefinition(Route $route) { public function summaryTitle() { $count = count($this->options['role']); if ($count < 1) { - return t('No role(s) selected'); + return $this->t('No role(s) selected'); } elseif ($count > 1) { - return t('Multiple roles'); + return $this->t('Multiple roles'); } else { $rids = user_role_names(); @@ -74,10 +74,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['role'] = array( '#type' => 'checkboxes', - '#title' => t('Role'), + '#title' => $this->t('Role'), '#default_value' => $this->options['role'], '#options' => array_map('\Drupal\Component\Utility\String::checkPlain', user_role_names()), - '#description' => t('Only the checked roles will be able to access this display. Note that users with "access all views" can see any view, regardless of role.'), + '#description' => $this->t('Only the checked roles will be able to access this display. Note that users with "access all views" can see any view, regardless of role.'), ); } @@ -86,7 +86,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { $role = array_filter($role); if (!$role) { - $form_state->setError($form['role'], t('You must select at least one role if type is "by role"')); + $form_state->setError($form['role'], $this->t('You must select at least one role if type is "by role"')); } $form_state->setValue(array('access_options', 'role'), $role); only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/argument_default/User.php +++ b/core/modules/user/src/Plugin/views/argument_default/User.php @@ -40,7 +40,7 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['user'] = array( '#type' => 'checkbox', - '#title' => t('Also look for a node and use the node author'), + '#title' => $this->t('Also look for a node and use the node author'), '#default_value' => $this->options['user'], ); } only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/Link.php +++ b/core/modules/user/src/Plugin/views/field/Link.php @@ -49,7 +49,7 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['text'] = array( '#type' => 'textfield', - '#title' => t('Text to display'), + '#title' => $this->t('Text to display'), '#default_value' => $this->options['text'], ); parent::buildOptionsForm($form, $form_state); @@ -87,7 +87,7 @@ public function render(ResultRow $values) { * The acutal rendered text (without the link) of this field. */ protected function renderLink(EntityInterface $entity, ResultRow $values) { - $text = !empty($this->options['text']) ? $this->options['text'] : t('View'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('View'); $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = $entity->getSystemPath(); only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/LinkCancel.php +++ b/core/modules/user/src/Plugin/views/field/LinkCancel.php @@ -26,7 +26,7 @@ protected function renderLink(EntityInterface $entity, ResultRow $values) { if ($entity && $entity->access('delete')) { $this->options['alter']['make_link'] = TRUE; - $text = !empty($this->options['text']) ? $this->options['text'] : t('Cancel account'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Cancel account'); $this->options['alter']['path'] = $entity->getSystemPath('cancel-form'); $this->options['alter']['query'] = drupal_get_destination(); only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/LinkEdit.php +++ b/core/modules/user/src/Plugin/views/field/LinkEdit.php @@ -26,7 +26,7 @@ protected function renderLink(EntityInterface $entity, ResultRow $values) { if ($entity && $entity->access('update')) { $this->options['alter']['make_link'] = TRUE; - $text = !empty($this->options['text']) ? $this->options['text'] : t('Edit'); + $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit'); $this->options['alter']['path'] = $entity->getSystemPath('edit-form'); $this->options['alter']['query'] = drupal_get_destination(); only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/Mail.php +++ b/core/modules/user/src/Plugin/views/field/Mail.php @@ -28,12 +28,12 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['link_to_user'] = array( - '#title' => t('Link this field'), + '#title' => $this->t('Link this field'), '#type' => 'radios', '#options' => array( - 0 => t('No link'), - 'user' => t('To the user'), - 'mailto' => t("With a mailto:"), + 0 => $this->t('No link'), + 'user' => $this->t('To the user'), + 'mailto' => $this->t("With a mailto:"), ), '#default_value' => $this->options['link_to_user'], ); only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/Name.php +++ b/core/modules/user/src/Plugin/views/field/Name.php @@ -53,19 +53,19 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['format_username'] = array( - '#title' => t('Use formatted username'), + '#title' => $this->t('Use formatted username'), '#type' => 'checkbox', '#default_value' => !empty($this->options['format_username']), - '#description' => t('If checked, the username will be formatted by the system. If unchecked, it will be displayed raw.'), + '#description' => $this->t('If checked, the username will be formatted by the system. If unchecked, it will be displayed raw.'), ); $form['overwrite_anonymous'] = array( - '#title' => t('Overwrite the value to display for anonymous users'), + '#title' => $this->t('Overwrite the value to display for anonymous users'), '#type' => 'checkbox', '#default_value' => !empty($this->options['overwrite_anonymous']), - '#description' => t('Enable to display different text for anonymous users.'), + '#description' => $this->t('Enable to display different text for anonymous users.'), ); $form['anonymous_text'] = array( - '#title' => t('Text to display for anonymous users'), + '#title' => $this->t('Text to display for anonymous users'), '#type' => 'textfield', '#default_value' => $this->options['anonymous_text'], '#states' => array( only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/Permissions.php +++ b/core/modules/user/src/Plugin/views/field/Permissions.php @@ -119,8 +119,8 @@ function render_item($count, $item) { /* protected function documentSelfTokens(&$tokens) { - $tokens['[' . $this->options['id'] . '-role' . ']'] = t('The name of the role.'); - $tokens['[' . $this->options['id'] . '-rid' . ']'] = t('The role ID of the role.'); + $tokens['[' . $this->options['id'] . '-role' . ']'] = $this->t('The name of the role.'); + $tokens['[' . $this->options['id'] . '-rid' . ']'] = $this->t('The role ID of the role.'); } protected function addSelfTokens(&$tokens, $item) { only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/Roles.php +++ b/core/modules/user/src/Plugin/views/field/Roles.php @@ -101,8 +101,8 @@ function render_item($count, $item) { } protected function documentSelfTokens(&$tokens) { - $tokens['[' . $this->options['id'] . '-role' . ']'] = t('The name of the role.'); - $tokens['[' . $this->options['id'] . '-rid' . ']'] = t('The role machine-name of the role.'); + $tokens['[' . $this->options['id'] . '-role' . ']'] = $this->t('The name of the role.'); + $tokens['[' . $this->options['id'] . '-rid' . ']'] = $this->t('The role machine-name of the role.'); } protected function addSelfTokens(&$tokens, $item) { only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/User.php +++ b/core/modules/user/src/Plugin/views/field/User.php @@ -44,8 +44,8 @@ protected function defineOptions() { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_to_user'] = array( - '#title' => t('Link this field to its user'), - '#description' => t("Enable to override this field's links."), + '#title' => $this->t('Link this field to its user'), + '#description' => $this->t("Enable to override this field's links."), '#type' => 'checkbox', '#default_value' => $this->options['link_to_user'], ); only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/UserBulkForm.php +++ b/core/modules/user/src/Plugin/views/field/UserBulkForm.php @@ -31,7 +31,7 @@ public function viewsForm(&$form, FormStateInterface $form_state) { foreach ($this->view->result as $row_index => $result) { $account = $result->_entity; if ($account instanceof UserInterface) { - $form[$this->options['id']][$row_index]['#title'] = t('Update the user %name', array('%name' => $account->label())); + $form[$this->options['id']][$row_index]['#title'] = $this->t('Update the user %name', array('%name' => $account->label())); } } } @@ -41,7 +41,7 @@ public function viewsForm(&$form, FormStateInterface $form_state) { * {@inheritdoc} */ protected function emptySelectedMessage() { - return t('No users selected.'); + return $this->t('No users selected.'); } } only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/UserData.php +++ b/core/modules/user/src/Plugin/views/field/UserData.php @@ -74,17 +74,17 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } $form['data_module'] = array( - '#title' => t('Module name'), + '#title' => $this->t('Module name'), '#type' => 'select', - '#description' => t('The module which sets this user data.'), + '#description' => $this->t('The module which sets this user data.'), '#default_value' => $this->options['data_module'], '#options' => $names, ); $form['data_name'] = array( - '#title' => t('Name'), + '#title' => $this->t('Name'), '#type' => 'textfield', - '#description' => t('The name of the data key.'), + '#description' => $this->t('The name of the data key.'), '#default_value' => $this->options['data_name'], ); } only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/filter/Current.php +++ b/core/modules/user/src/Plugin/views/filter/Current.php @@ -26,7 +26,7 @@ class Current extends BooleanOperator { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->value_value = t('Is the logged in user'); + $this->value_value = $this->t('Is the logged in user'); } public function query() { only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/filter/Name.php +++ b/core/modules/user/src/Plugin/views/filter/Name.php @@ -40,8 +40,8 @@ protected function valueForm(&$form, FormStateInterface $form_state) { $default_value = implode(', ', $values); $form['value'] = array( '#type' => 'textfield', - '#title' => t('Usernames'), - '#description' => t('Enter a comma separated list of user names.'), + '#title' => $this->t('Usernames'), + '#description' => $this->t('Enter a comma separated list of user names.'), '#default_value' => $default_value, '#autocomplete_route_name' => 'user.autocomplete_anonymous', ); only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/filter/Roles.php +++ b/core/modules/user/src/Plugin/views/filter/Roles.php @@ -28,8 +28,8 @@ public function getValueOptions() { */ function operators() { $operators = parent::operators(); - $operators['empty']['title'] = t("Only has the 'authenticated user' role"); - $operators['not empty']['title'] = t("Has roles in addition to 'authenticated user'"); + $operators['empty']['title'] = $this->t("Only has the 'authenticated user' role"); + $operators['not empty']['title'] = $this->t("Has roles in addition to 'authenticated user'"); return $operators; } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/HandlerBase.php +++ b/core/modules/views/src/Plugin/views/HandlerBase.php @@ -282,7 +282,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['admin_label'] = array( '#type' => 'details', - '#title' => t('Administrative title'), + '#title' =>$this->t('Administrative title'), '#weight' => 150, ); $form['admin_label']['admin_label'] = array( @@ -297,7 +297,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // belongs in "Administrative title" fieldset at the bottom of the form. $form['more'] = array( '#type' => 'details', - '#title' => t('More'), + '#title' => $this->t('More'), '#weight' => 200, ); // Allow to alter the default values brought into the form. only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/PluginBase.php +++ b/core/modules/views/src/Plugin/views/PluginBase.php @@ -123,7 +123,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o * @code * 'option_name' => array( * - 'default' => default value, - * - 'translatable' => (optional) TRUE/FALSE (wrap in t() on export if true), + * - 'translatable' => (optional) TRUE/FALSE (wrap in $this->t() on export if true), * - 'contains' => (optional) array of items this contains, with its own * defaults, etc. If contains is set, the default will be ignored and * assumed to be array(). @@ -251,7 +251,7 @@ public function validate() { return array(); } * {@inheritdoc} */ public function summaryTitle() { - return t('Settings'); + return $this->t('Settings'); } /** @@ -323,7 +323,7 @@ public function globalTokenForm(&$form, FormStateInterface $form_state) { $form['global_tokens'] = array( '#type' => 'details', - '#title' => t('Available global token replacements'), + '#title' => $this->t('Available global token replacements'), ); $form['global_tokens']['list'] = array( '#theme' => 'item_list', @@ -410,7 +410,7 @@ protected function listLanguages($flags = LanguageInterface::STATE_ALL) { if ($id == 'site_default') { $id = '***LANGUAGE_' . $id . '***'; } - $list[$id] = t($language->name); + $list[$id] = $this->t($language->name); } // Add in negotiated languages, if requested. @@ -422,7 +422,7 @@ protected function listLanguages($flags = LanguageInterface::STATE_ALL) { // IDs by '***LANGUAGE_...***', to avoid query collisions. if (isset($type['name'])) { $id = '***LANGUAGE_' . $id . '***'; - $list[$id] = t('Language selected for !type', array('!type' => $type['name'])); + $list[$id] = $this->t('Language selected for !type', array('!type' => $type['name'])); } } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/access/AccessPluginBase.php +++ b/core/modules/views/src/Plugin/views/access/AccessPluginBase.php @@ -36,7 +36,7 @@ * {@inheritdoc} */ public function summaryTitle() { - return t('Unknown'); + return $this->t('Unknown'); } /** only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/access/None.php +++ b/core/modules/views/src/Plugin/views/access/None.php @@ -27,7 +27,7 @@ class None extends AccessPluginBase { * {@inheritdoc} */ public function summaryTitle() { - return t('Unrestricted'); + return $this->t('Unrestricted'); } /** only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/area/AreaPluginBase.php +++ b/core/modules/views/src/Plugin/views/area/AreaPluginBase.php @@ -88,7 +88,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { if ($form_state->get('type') != 'empty') { $form['empty'] = array( '#type' => 'checkbox', - '#title' => t('Display even if view has no result'), + '#title' => $this->t('Display even if view has no result'), '#default_value' => isset($this->options['empty']) ? $this->options['empty'] : 0, ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/area/Entity.php +++ b/core/modules/views/src/Plugin/views/area/Entity.php @@ -61,20 +61,20 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['view_mode'] = array( '#type' => 'select', '#options' => \Drupal::entityManager()->getViewModeOptions($this->entityType), - '#title' => t('View mode'), + '#title' => $this->t('View mode'), '#default_value' => $this->options['view_mode'], ); $form['entity_id'] = array( - '#title' => t('ID'), + '#title' => $this->t('ID'), '#type' => 'textfield', '#default_value' => $this->options['entity_id'], ); $form['bypass_access'] = array( '#type' => 'checkbox', - '#title' => t('Bypass access checks'), - '#description' => t('If enabled, access permissions for rendering the entity are not checked.'), + '#title' => $this->t('Bypass access checks'), + '#description' => $this->t('If enabled, access permissions for rendering the entity are not checked.'), '#default_value' => !empty($this->options['bypass_access']), ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/area/HTTPStatusCode.php +++ b/core/modules/views/src/Plugin/views/area/HTTPStatusCode.php @@ -48,11 +48,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // Add the HTTP status code, so it's easier for people to find it. array_walk($options, function($title, $code) use(&$options) { - $options[$code] = t('@code (!title)', array('@code' => $code, '!title' => $title)); + $options[$code] = $this->t('@code (!title)', array('@code' => $code, '!title' => $title)); }); $form['status_code'] = array( - '#title' => t('HTTP status code'), + '#title' => $this->t('HTTP status code'), '#type' => 'select', '#default_value' => $this->options['status_code'], '#options' => $options, only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/area/Result.php +++ b/core/modules/views/src/Plugin/views/area/Result.php @@ -55,11 +55,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $list = drupal_render($item_list); $form['content'] = array( - '#title' => t('Display'), + '#title' => $this->t('Display'), '#type' => 'textarea', '#rows' => 3, '#default_value' => $this->options['content'], - '#description' => t('You may use HTML code in this field. The following tokens are supported:') . $list, + '#description' => $this->t('You may use HTML code in this field. The following tokens are supported:') . $list, ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/area/Text.php +++ b/core/modules/views/src/Plugin/views/area/Text.php @@ -35,7 +35,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['content'] = array( - '#title' => t('Content'), + '#title' => $this->t('Content'), '#type' => 'text_format', '#default_value' => $this->options['content'], '#rows' => 6, only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/area/TextCustom.php +++ b/core/modules/views/src/Plugin/views/area/TextCustom.php @@ -34,7 +34,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['content'] = array( - '#title' => t('Content'), + '#title' => $this->t('Content'), '#type' => 'textarea', '#default_value' => $this->options['content'], '#rows' => 6, only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/area/Title.php +++ b/core/modules/views/src/Plugin/views/area/Title.php @@ -36,9 +36,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['title'] = array( '#type' => 'textfield', - '#title' => t('Overridden title'), + '#title' => $this->t('Overridden title'), '#default_value' => $this->options['title'], - '#description' => t('Override the title of this view when it is empty. The available global tokens below can be used here.'), + '#description' => $this->t('Override the title of this view when it is empty. The available global tokens below can be used here.'), ); // Don't use the AreaPluginBase tokenForm method, we don't want row tokens. only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/area/TokenizeAreaPluginBase.php +++ b/core/modules/views/src/Plugin/views/area/TokenizeAreaPluginBase.php @@ -46,7 +46,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { public function tokenForm(&$form, FormStateInterface $form_state) { $form['tokenize'] = array( '#type' => 'checkbox', - '#title' => t('Use replacement tokens from the first row'), + '#title' => $this->t('Use replacement tokens from the first row'), '#default_value' => $this->options['tokenize'], ); @@ -58,14 +58,14 @@ public function tokenForm(&$form, FormStateInterface $form_state) { $count = 0; // This lets us prepare the key as we want it printed. foreach ($this->view->display_handler->getHandlers('argument') as $handler) { - $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->adminLabel())); - $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->adminLabel())); + $options[t('Arguments')]['%' . ++$count] = $this->t('@argument title', array('@argument' => $handler->adminLabel())); + $options[t('Arguments')]['!' . $count] = $this->t('@argument input', array('@argument' => $handler->adminLabel())); } if (!empty($options)) { $form['tokens'] = array( '#type' => 'details', - '#title' => t('Replacement patterns'), + '#title' => $this->t('Replacement patterns'), '#open' => TRUE, '#id' => 'edit-options-token-help', '#states' => array( @@ -75,7 +75,7 @@ public function tokenForm(&$form, FormStateInterface $form_state) { ), ); $form['tokens']['help'] = array( - '#markup' => '

' . t('The following tokens are available. If you would like to have the characters \'[\' and \']\' use the html entity codes \'%5B\' or \'%5D\' or they will get replaced with empty space.') . '

', + '#markup' => '

' . $this->t('The following tokens are available. If you would like to have the characters \'[\' and \']\' use the html entity codes \'%5B\' or \'%5D\' or they will get replaced with empty space.') . '

', ); foreach (array_keys($options) as $type) { if (!empty($options[$type])) { only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/area/View.php +++ b/core/modules/views/src/Plugin/views/area/View.php @@ -84,21 +84,21 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $view_display = $this->view->storage->id() . ':' . $this->view->current_display; - $options = array('' => t('-Select-')); + $options = array('' => $this->t('-Select-')); $options += Views::getViewsAsOptions(FALSE, 'all', $view_display, FALSE, TRUE); $form['view_to_insert'] = array( '#type' => 'select', - '#title' => t('View to insert'), + '#title' => $this->t('View to insert'), '#default_value' => $this->options['view_to_insert'], - '#description' => t('The view to insert into this area.'), + '#description' => $this->t('The view to insert into this area.'), '#options' => $options, ); $form['inherit_arguments'] = array( '#type' => 'checkbox', - '#title' => t('Inherit contextual filters'), + '#title' => $this->t('Inherit contextual filters'), '#default_value' => $this->options['inherit_arguments'], - '#description' => t('If checked, this view will receive the same contextual filters as its parent.'), + '#description' => $this->t('If checked, this view will receive the same contextual filters as its parent.'), ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php +++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php @@ -47,7 +47,7 @@ * - empty field name: For arguments that can have no value, such as taxonomy * which can have "no term", this is the string which * will be displayed for this lack of value. Be sure to use - * t(). + * $this->t(). * - validate type: A little used string to allow an argument to restrict * which validator is available to just one. Use the * validator ID. This probably should not be used at all, @@ -176,7 +176,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#markup' => '
', ); $form['default_action'] = array( - '#title' => t('Default actions'), + '#title' => $this->t('Default actions'), '#title_display' => 'invisible', '#type' => 'radios', '#process' => array(array($this, 'processContainerRadios')), @@ -186,28 +186,28 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['exception'] = array( '#type' => 'details', - '#title' => t('Exceptions'), + '#title' => $this->t('Exceptions'), '#fieldset' => 'no_argument', ); $form['exception']['value'] = array( '#type' => 'textfield', - '#title' => t('Exception value'), + '#title' => $this->t('Exception value'), '#size' => 20, '#default_value' => $this->options['exception']['value'], - '#description' => t('If this value is received, the filter will be ignored; i.e, "all values"'), + '#description' => $this->t('If this value is received, the filter will be ignored; i.e, "all values"'), ); $form['exception']['title_enable'] = array( '#type' => 'checkbox', - '#title' => t('Override title'), + '#title' => $this->t('Override title'), '#default_value' => $this->options['exception']['title_enable'], ); $form['exception']['title'] = array( '#type' => 'textfield', - '#title' => t('Override title'), + '#title' => $this->t('Override title'), '#title_display' => 'invisible', '#size' => 20, '#default_value' => $this->options['exception']['title'], - '#description' => t('Override the view and other argument titles. Use "%1" for the first argument, "%2" for the second, etc.'), + '#description' => $this->t('Override the view and other argument titles. Use "%1" for the first argument, "%2" for the second, etc.'), '#states' => array( 'visible' => array( ':input[name="options[exception][title_enable]"]' => array('checked' => TRUE), @@ -236,16 +236,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['title_enable'] = array( '#type' => 'checkbox', - '#title' => t('Override title'), + '#title' => $this->t('Override title'), '#default_value' => $this->options['title_enable'], '#fieldset' => 'argument_present', ); $form['title'] = array( '#type' => 'textfield', - '#title' => t('Provide title'), + '#title' => $this->t('Provide title'), '#title_display' => 'invisible', '#default_value' => $this->options['title'], - '#description' => t('Override the view and other argument titles. Use "%1" for the first argument, "%2" for the second, etc.'), + '#description' => $this->t('Override the view and other argument titles. Use "%1" for the first argument, "%2" for the second, etc.'), '#states' => array( 'visible' => array( ':input[name="options[title_enable]"]' => array('checked' => TRUE), @@ -256,7 +256,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['specify_validation'] = array( '#type' => 'checkbox', - '#title' => t('Specify validation criteria'), + '#title' => $this->t('Specify validation criteria'), '#default_value' => $this->options['specify_validation'], '#fieldset' => 'argument_present', ); @@ -269,7 +269,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // and reverted on submission. $form['validate']['type'] = array( '#type' => 'select', - '#title' => t('Validator'), + '#title' => $this->t('Validator'), '#default_value' => static::encodeValidatorId($this->options['validate']['type']), '#states' => array( 'visible' => array( @@ -332,7 +332,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['validate']['fail'] = array( '#type' => 'select', - '#title' => t('Action to take if filter value does not validate'), + '#title' => $this->t('Action to take if filter value does not validate'), '#default_value' => $this->options['validate']['fail'], '#options' => $validate_options, '#states' => array( @@ -426,39 +426,39 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) { protected function defaultActions($which = NULL) { $defaults = array( 'ignore' => array( - 'title' => t('Display all results for the specified field'), + 'title' => $this->t('Display all results for the specified field'), 'method' => 'defaultIgnore', ), 'default' => array( - 'title' => t('Provide default value'), + 'title' => $this->t('Provide default value'), 'method' => 'defaultDefault', 'form method' => 'defaultArgumentForm', 'has default argument' => TRUE, 'default only' => TRUE, // this can only be used for missing argument, not validation failure ), 'not found' => array( - 'title' => t('Hide view'), + 'title' => $this->t('Hide view'), 'method' => 'defaultNotFound', 'hard fail' => TRUE, // This is a hard fail condition ), 'summary' => array( - 'title' => t('Display a summary'), + 'title' => $this->t('Display a summary'), 'method' => 'defaultSummary', 'form method' => 'defaultSummaryForm', 'style plugin' => TRUE, ), 'empty' => array( - 'title' => t('Display contents of "No results found"'), + 'title' => $this->t('Display contents of "No results found"'), 'method' => 'defaultEmpty', ), 'access denied' => array( - 'title' => t('Display "Access Denied"'), + 'title' => $this->t('Display "Access Denied"'), 'method' => 'defaultAccessDenied', ), ); if ($this->view->display_handler->hasPath()) { - $defaults['not found']['title'] = t('Show "Page not found"'); + $defaults['not found']['title'] = $this->t('Show "Page not found"'); } if ($which) { @@ -481,9 +481,9 @@ public function defaultArgumentForm(&$form, FormStateInterface $form_state) { $form['default_argument_skip_url'] = array( '#type' => 'checkbox', - '#title' => t('Skip default argument for view URL'), + '#title' => $this->t('Skip default argument for view URL'), '#default_value' => $this->options['default_argument_skip_url'], - '#description' => t('Select whether to include this default argument when constructing the URL for this view. Skipping default arguments is useful e.g. in the case of feeds.') + '#description' => $this->t('Select whether to include this default argument when constructing the URL for this view. Skipping default arguments is useful e.g. in the case of feeds.') ); $form['default_argument_type'] = array( @@ -491,7 +491,7 @@ public function defaultArgumentForm(&$form, FormStateInterface $form_state) { '#suffix' => '', '#type' => 'select', '#id' => 'edit-options-default-argument-type', - '#title' => t('Type'), + '#title' => $this->t('Type'), '#default_value' => $this->options['default_argument_type'], '#states' => array( 'visible' => array( @@ -558,8 +558,8 @@ public function defaultSummaryForm(&$form, FormStateInterface $form_state) { ); $form['summary']['sort_order'] = array( '#type' => 'radios', - '#title' => t('Sort order'), - '#options' => array('asc' => t('Ascending'), 'desc' => t('Descending')), + '#title' => $this->t('Sort order'), + '#options' => array('asc' => $this->t('Ascending'), 'desc' => $this->t('Descending')), '#default_value' => $this->options['summary']['sort_order'], '#states' => array( 'visible' => array( @@ -569,11 +569,11 @@ public function defaultSummaryForm(&$form, FormStateInterface $form_state) { ); $form['summary']['number_of_records'] = array( '#type' => 'radios', - '#title' => t('Sort by'), + '#title' => $this->t('Sort by'), '#default_value' => $this->options['summary']['number_of_records'], '#options' => array( 0 => $this->getSortName(), - 1 => t('Number of records') + 1 => $this->t('Number of records') ), '#states' => array( 'visible' => array( @@ -584,7 +584,7 @@ public function defaultSummaryForm(&$form, FormStateInterface $form_state) { $form['summary']['format'] = array( '#type' => 'radios', - '#title' => t('Format'), + '#title' => $this->t('Format'), '#options' => $format_options, '#default_value' => $this->options['summary']['format'], '#states' => array( @@ -1054,7 +1054,7 @@ public function getPlugin($type = 'argument_default', $name = NULL) { * their argument is (e.g. alphabetical, numeric, date). */ public function getSortName() { - return t('Default sort', array(), array('context' => 'Sort order')); + return $this->t('Default sort', array(), array('context' => 'Sort order')); } /** only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument/GroupByNumeric.php +++ b/core/modules/views/src/Plugin/views/argument/GroupByNumeric.php @@ -32,7 +32,7 @@ public function adminLabel($short = FALSE) { * {@inheritdoc} */ public function getSortName() { - return t('Numerical', array(), array('context' => 'Sort order')); + return $this->t('Numerical', array(), array('context' => 'Sort order')); } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument/LanguageArgument.php +++ b/core/modules/views/src/Plugin/views/argument/LanguageArgument.php @@ -47,7 +47,7 @@ function title() { */ function language($langcode) { $languages = $this->listLanguages(); - return isset($languages[$langcode]) ? $languages[$langcode] : t('Unknown language'); + return isset($languages[$langcode]) ? $languages[$langcode] : $this->t('Unknown language'); } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument/ManyToOne.php +++ b/core/modules/views/src/Plugin/views/argument/ManyToOne.php @@ -69,23 +69,23 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // allow + for or, , for and $form['break_phrase'] = array( '#type' => 'checkbox', - '#title' => t('Allow multiple values'), - '#description' => t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'), + '#title' => $this->t('Allow multiple values'), + '#description' => $this->t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'), '#default_value' => !empty($this->options['break_phrase']), '#fieldset' => 'more', ); $form['add_table'] = array( '#type' => 'checkbox', - '#title' => t('Allow multiple filter values to work together'), - '#description' => t('If selected, multiple instances of this filter can work together, as though multiple values were supplied to the same filter. This setting is not compatible with the "Reduce duplicates" setting.'), + '#title' => $this->t('Allow multiple filter values to work together'), + '#description' => $this->t('If selected, multiple instances of this filter can work together, as though multiple values were supplied to the same filter. This setting is not compatible with the "Reduce duplicates" setting.'), '#default_value' => !empty($this->options['add_table']), '#fieldset' => 'more', ); $form['require_value'] = array( '#type' => 'checkbox', - '#title' => t('Do not display items with no value in summary'), + '#title' => $this->t('Do not display items with no value in summary'), '#default_value' => !empty($this->options['require_value']), '#fieldset' => 'more', ); @@ -133,7 +133,7 @@ public function query($group_by = FALSE) { function title() { if (!$this->argument) { - return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized'); + return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized'); } if (!empty($this->options['break_phrase'])) { @@ -148,11 +148,11 @@ function title() { // @todo -- both of these should check definition for alternate keywords. if (empty($this->value)) { - return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized'); + return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized'); } if ($this->value === array(-1)) { - return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : t('Invalid input'); + return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : $this->t('Invalid input'); } return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery()); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument/Null.php +++ b/core/modules/views/src/Plugin/views/argument/Null.php @@ -32,9 +32,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['must_not_be'] = array( '#type' => 'checkbox', - '#title' => t('Fail basic validation if any argument is given'), + '#title' => $this->t('Fail basic validation if any argument is given'), '#default_value' => !empty($this->options['must_not_be']), - '#description' => t('By checking this field, you can use this to make sure views with more arguments than necessary fail validation.'), + '#description' => $this->t('By checking this field, you can use this to make sure views with more arguments than necessary fail validation.'), '#fieldset' => 'more', ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument/Numeric.php +++ b/core/modules/views/src/Plugin/views/argument/Numeric.php @@ -46,16 +46,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // allow + for or, , for and $form['break_phrase'] = array( '#type' => 'checkbox', - '#title' => t('Allow multiple values'), - '#description' => t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'), + '#title' => $this->t('Allow multiple values'), + '#description' => $this->t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'), '#default_value' => !empty($this->options['break_phrase']), '#fieldset' => 'more', ); $form['not'] = array( '#type' => 'checkbox', - '#title' => t('Exclude'), - '#description' => t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'), + '#title' => $this->t('Exclude'), + '#description' => $this->t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'), '#default_value' => !empty($this->options['not']), '#fieldset' => 'more', ); @@ -63,7 +63,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { function title() { if (!$this->argument) { - return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized'); + return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized'); } if (!empty($this->options['break_phrase'])) { @@ -77,11 +77,11 @@ function title() { } if (empty($this->value)) { - return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized'); + return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized'); } if ($this->value === array(-1)) { - return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : t('Invalid input'); + return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : $this->t('Invalid input'); } return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery()); @@ -125,7 +125,7 @@ public function query($group_by = FALSE) { * {@inheritdoc} */ public function getSortName() { - return t('Numerical', array(), array('context' => 'Sort order')); + return $this->t('Numerical', array(), array('context' => 'Sort order')); } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument/String.php +++ b/core/modules/views/src/Plugin/views/argument/String.php @@ -60,16 +60,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['glossary'] = array( '#type' => 'checkbox', - '#title' => t('Glossary mode'), - '#description' => t('Glossary mode applies a limit to the number of characters used in the filter value, which allows the summary view to act as a glossary.'), + '#title' => $this->t('Glossary mode'), + '#description' => $this->t('Glossary mode applies a limit to the number of characters used in the filter value, which allows the summary view to act as a glossary.'), '#default_value' => $this->options['glossary'], '#fieldset' => 'more', ); $form['limit'] = array( '#type' => 'textfield', - '#title' => t('Character limit'), - '#description' => t('How many characters of the filter value to filter against. If set to 1, all fields starting with the first letter in the filter value would be matched.'), + '#title' => $this->t('Character limit'), + '#description' => $this->t('How many characters of the filter value to filter against. If set to 1, all fields starting with the first letter in the filter value would be matched.'), '#default_value' => $this->options['limit'], '#states' => array( 'visible' => array( @@ -81,14 +81,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['case'] = array( '#type' => 'select', - '#title' => t('Case'), - '#description' => t('When printing the title and summary, how to transform the case of the filter value.'), + '#title' => $this->t('Case'), + '#description' => $this->t('When printing the title and summary, how to transform the case of the filter value.'), '#options' => array( - 'none' => t('No transform'), - 'upper' => t('Upper case'), - 'lower' => t('Lower case'), - 'ucfirst' => t('Capitalize first letter'), - 'ucwords' => t('Capitalize each word'), + 'none' => $this->t('No transform'), + 'upper' => $this->t('Upper case'), + 'lower' => $this->t('Lower case'), + 'ucfirst' => $this->t('Capitalize first letter'), + 'ucwords' => $this->t('Capitalize each word'), ), '#default_value' => $this->options['case'], '#fieldset' => 'more', @@ -96,14 +96,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['path_case'] = array( '#type' => 'select', - '#title' => t('Case in path'), - '#description' => t('When printing url paths, how to transform the case of the filter value. Do not use this unless with Postgres as it uses case sensitive comparisons.'), + '#title' => $this->t('Case in path'), + '#description' => $this->t('When printing url paths, how to transform the case of the filter value. Do not use this unless with Postgres as it uses case sensitive comparisons.'), '#options' => array( - 'none' => t('No transform'), - 'upper' => t('Upper case'), - 'lower' => t('Lower case'), - 'ucfirst' => t('Capitalize first letter'), - 'ucwords' => t('Capitalize each word'), + 'none' => $this->t('No transform'), + 'upper' => $this->t('Upper case'), + 'lower' => $this->t('Lower case'), + 'ucfirst' => $this->t('Capitalize first letter'), + 'ucwords' => $this->t('Capitalize each word'), ), '#default_value' => $this->options['path_case'], '#fieldset' => 'more', @@ -111,7 +111,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['transform_dash'] = array( '#type' => 'checkbox', - '#title' => t('Transform spaces to dashes in URL'), + '#title' => $this->t('Transform spaces to dashes in URL'), '#default_value' => $this->options['transform_dash'], '#fieldset' => 'more', ); @@ -119,15 +119,15 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { if (!empty($this->definition['many to one'])) { $form['add_table'] = array( '#type' => 'checkbox', - '#title' => t('Allow multiple filter values to work together'), - '#description' => t('If selected, multiple instances of this filter can work together, as though multiple values were supplied to the same filter. This setting is not compatible with the "Reduce duplicates" setting.'), + '#title' => $this->t('Allow multiple filter values to work together'), + '#description' => $this->t('If selected, multiple instances of this filter can work together, as though multiple values were supplied to the same filter. This setting is not compatible with the "Reduce duplicates" setting.'), '#default_value' => !empty($this->options['add_table']), '#fieldset' => 'more', ); $form['require_value'] = array( '#type' => 'checkbox', - '#title' => t('Do not display items with no value in summary'), + '#title' => $this->t('Do not display items with no value in summary'), '#default_value' => !empty($this->options['require_value']), '#fieldset' => 'more', ); @@ -136,8 +136,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // allow + for or, , for and $form['break_phrase'] = array( '#type' => 'checkbox', - '#title' => t('Allow multiple values'), - '#description' => t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'), + '#title' => $this->t('Allow multiple values'), + '#description' => $this->t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'), '#default_value' => !empty($this->options['break_phrase']), '#fieldset' => 'more', ); @@ -253,7 +253,7 @@ public function summaryArgument($data) { * {@inheritdoc} */ public function getSortName() { - return t('Alphabetical', array(), array('context' => 'Sort order')); + return $this->t('Alphabetical', array(), array('context' => 'Sort order')); } function title() { @@ -271,11 +271,11 @@ function title() { } if (empty($this->value)) { - return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : t('Uncategorized'); + return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized'); } if ($this->value === array(-1)) { - return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : t('Invalid input'); + return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : $this->t('Invalid input'); } return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery()); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument/WeekDate.php +++ b/core/modules/views/src/Plugin/views/argument/WeekDate.php @@ -24,7 +24,7 @@ class WeekDate extends Date { */ public function summaryName($data) { $created = $data->{$this->name_alias}; - return t('Week @week', array('@week' => $created)); + return $this->t('Week @week', array('@week' => $created)); } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument_default/ArgumentDefaultPluginBase.php +++ b/core/modules/views/src/Plugin/views/argument_default/ArgumentDefaultPluginBase.php @@ -98,7 +98,7 @@ protected function checkAccess(&$form, $option_name) { if (!$this->access()) { $form[$option_name]['#disabled'] = TRUE; $form[$option_name]['#value'] = $form[$this->option_name]['#default_value']; - $form[$option_name]['#description'] .= ' ' . t('Note: you do not have permission to modify this. If you change the default filter type, this setting will be lost and you will NOT be able to get it back.') . ''; + $form[$option_name]['#description'] .= ' ' . $this->t('Note: you do not have permission to modify this. If you change the default filter type, this setting will be lost and you will NOT be able to get it back.') . ''; } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument_default/Fixed.php +++ b/core/modules/views/src/Plugin/views/argument_default/Fixed.php @@ -32,7 +32,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['argument'] = array( '#type' => 'textfield', - '#title' => t('Fixed value'), + '#title' => $this->t('Fixed value'), '#default_value' => $this->options['argument'], ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument_default/Raw.php +++ b/core/modules/views/src/Plugin/views/argument_default/Raw.php @@ -73,19 +73,19 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['index'] = array( '#type' => 'select', - '#title' => t('Path component'), + '#title' => $this->t('Path component'), '#default_value' => $this->options['index'], // range(1, 10) returns an array with: // - keys that count from 0 to match PHP array keys from explode(). // - values that count from 1 for display to humans. '#options' => range(1, 10), - '#description' => t('The numbering starts from 1, e.g. on the page admin/structure/types, the 3rd path component is "types".'), + '#description' => $this->t('The numbering starts from 1, e.g. on the page admin/structure/types, the 3rd path component is "types".'), ); $form['use_alias'] = array( '#type' => 'checkbox', - '#title' => t('Use path alias'), + '#title' => $this->t('Use path alias'), '#default_value' => $this->options['use_alias'], - '#description' => t('Use path alias instead of internal path.'), + '#description' => $this->t('Use path alias instead of internal path.'), ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php +++ b/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php @@ -93,7 +93,7 @@ protected function checkAccess(&$form, $option_name) { if (!$this->access()) { $form[$option_name]['#disabled'] = TRUE; $form[$option_name]['#value'] = $form[$this->option_name]['#default_value']; - $form[$option_name]['#description'] .= ' ' . t('Note: you do not have permission to modify this. If you change the default filter type, this setting will be lost and you will NOT be able to get it back.') . ''; + $form[$option_name]['#description'] .= ' ' . $this->t('Note: you do not have permission to modify this. If you change the default filter type, this setting will be lost and you will NOT be able to get it back.') . ''; } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php +++ b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php @@ -96,7 +96,7 @@ public function getResultsKey() { * access control. */ public function summaryTitle() { - return t('Unknown'); + return $this->t('Unknown'); } /** only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/cache/None.php +++ b/core/modules/views/src/Plugin/views/cache/None.php @@ -24,7 +24,7 @@ public function cacheStart() { } public function summaryTitle() { - return t('None'); + return $this->t('None'); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/cache/Tag.php +++ b/core/modules/views/src/Plugin/views/cache/Tag.php @@ -24,7 +24,7 @@ class Tag extends CachePluginBase { * {@inheritdoc} */ public function summaryTitle() { - return t('Tag'); + return $this->t('Tag'); } /** only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/cache/Time.php +++ b/core/modules/views/src/Plugin/views/cache/Time.php @@ -80,21 +80,21 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $options = array(60, 300, 1800, 3600, 21600, 518400); $options = array_map(array($this->dateFormatter, 'formatInterval'), array_combine($options, $options)); - $options = array(-1 => t('Never cache')) + $options + array('custom' => t('Custom')); + $options = array(-1 => $this->t('Never cache')) + $options + array('custom' => $this->t('Custom')); $form['results_lifespan'] = array( '#type' => 'select', - '#title' => t('Query results'), - '#description' => t('The length of time raw query results should be cached.'), + '#title' => $this->t('Query results'), + '#description' => $this->t('The length of time raw query results should be cached.'), '#options' => $options, '#default_value' => $this->options['results_lifespan'], ); $form['results_lifespan_custom'] = array( '#type' => 'textfield', - '#title' => t('Seconds'), + '#title' => $this->t('Seconds'), '#size' => '25', '#maxlength' => '30', - '#description' => t('Length of time in seconds raw query results should be cached.'), + '#description' => $this->t('Length of time in seconds raw query results should be cached.'), '#default_value' => $this->options['results_lifespan_custom'], '#states' => array( 'visible' => array( @@ -104,17 +104,17 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['output_lifespan'] = array( '#type' => 'select', - '#title' => t('Rendered output'), - '#description' => t('The length of time rendered HTML output should be cached.'), + '#title' => $this->t('Rendered output'), + '#description' => $this->t('The length of time rendered HTML output should be cached.'), '#options' => $options, '#default_value' => $this->options['output_lifespan'], ); $form['output_lifespan_custom'] = array( '#type' => 'textfield', - '#title' => t('Seconds'), + '#title' => $this->t('Seconds'), '#size' => '25', '#maxlength' => '30', - '#description' => t('Length of time in seconds rendered HTML output should be cached.'), + '#description' => $this->t('Length of time in seconds rendered HTML output should be cached.'), '#default_value' => $this->options['output_lifespan_custom'], '#states' => array( 'visible' => array( @@ -129,7 +129,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { foreach ($custom_fields as $field) { $cache_options = $form_state->getValue('cache_options'); if ($cache_options[$field] == 'custom' && !is_numeric($cache_options[$field . '_custom'])) { - $form_state->setError($form[$field .'_custom'], t('Custom time values must be numeric.')); + $form_state->setError($form[$field .'_custom'], $this->t('Custom time values must be numeric.')); } } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/display/Attachment.php +++ b/core/modules/views/src/Plugin/views/display/Attachment.php @@ -56,9 +56,9 @@ public function execute() { public function attachmentPositions($position = NULL) { $positions = array( - 'before' => t('Before'), - 'after' => t('After'), - 'both' => t('Both'), + 'before' => $this->t('Before'), + 'after' => $this->t('After'), + 'both' => $this->t('Both'), ); if ($position) { @@ -78,7 +78,7 @@ public function optionsSummary(&$categories, &$options) { parent::optionsSummary($categories, $options); $categories['attachment'] = array( - 'title' => t('Attachment settings'), + 'title' => $this->t('Attachment settings'), 'column' => 'second', 'build' => array( '#weight' => -10, @@ -87,7 +87,7 @@ public function optionsSummary(&$categories, &$options) { $displays = array_filter($this->getOption('displays')); if (count($displays) > 1) { - $attach_to = t('Multiple displays'); + $attach_to = $this->t('Multiple displays'); } elseif (count($displays) == 1) { $display = array_shift($displays); @@ -97,43 +97,43 @@ public function optionsSummary(&$categories, &$options) { } if (!isset($attach_to)) { - $attach_to = t('Not defined'); + $attach_to = $this->t('Not defined'); } $options['displays'] = array( 'category' => 'attachment', - 'title' => t('Attach to'), + 'title' => $this->t('Attach to'), 'value' => $attach_to, ); $options['attachment_position'] = array( 'category' => 'attachment', - 'title' => t('Attachment position'), + 'title' => $this->t('Attachment position'), 'value' => $this->attachmentPositions($this->getOption('attachment_position')), ); $options['inherit_arguments'] = array( 'category' => 'attachment', - 'title' => t('Inherit contextual filters'), - 'value' => $this->getOption('inherit_arguments') ? t('Yes') : t('No'), + 'title' => $this->t('Inherit contextual filters'), + 'value' => $this->getOption('inherit_arguments') ? $this->t('Yes') : $this->t('No'), ); $options['inherit_exposed_filters'] = array( 'category' => 'attachment', - 'title' => t('Inherit exposed filters'), - 'value' => $this->getOption('inherit_exposed_filters') ? t('Yes') : t('No'), + 'title' => $this->t('Inherit exposed filters'), + 'value' => $this->getOption('inherit_exposed_filters') ? $this->t('Yes') : $this->t('No'), ); $options['inherit_pager'] = array( 'category' => 'pager', - 'title' => t('Inherit pager'), - 'value' => $this->getOption('inherit_pager') ? t('Yes') : t('No'), + 'title' => $this->t('Inherit pager'), + 'value' => $this->getOption('inherit_pager') ? $this->t('Yes') : $this->t('No'), ); $options['render_pager'] = array( 'category' => 'pager', - 'title' => t('Render pager'), - 'value' => $this->getOption('render_pager') ? t('Yes') : t('No'), + 'title' => $this->t('Render pager'), + 'value' => $this->getOption('render_pager') ? $this->t('Yes') : $this->t('No'), ); } @@ -147,53 +147,53 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'inherit_arguments': - $form['#title'] .= t('Inherit contextual filters'); + $form['#title'] .= $this->t('Inherit contextual filters'); $form['inherit_arguments'] = array( '#type' => 'checkbox', - '#title' => t('Inherit'), - '#description' => t('Should this display inherit its contextual filter values from the parent display to which it is attached?'), + '#title' => $this->t('Inherit'), + '#description' => $this->t('Should this display inherit its contextual filter values from the parent display to which it is attached?'), '#default_value' => $this->getOption('inherit_arguments'), ); break; case 'inherit_exposed_filters': - $form['#title'] .= t('Inherit exposed filters'); + $form['#title'] .= $this->t('Inherit exposed filters'); $form['inherit_exposed_filters'] = array( '#type' => 'checkbox', - '#title' => t('Inherit'), - '#description' => t('Should this display inherit its exposed filter values from the parent display to which it is attached?'), + '#title' => $this->t('Inherit'), + '#description' => $this->t('Should this display inherit its exposed filter values from the parent display to which it is attached?'), '#default_value' => $this->getOption('inherit_exposed_filters'), ); break; case 'inherit_pager': - $form['#title'] .= t('Inherit pager'); + $form['#title'] .= $this->t('Inherit pager'); $form['inherit_pager'] = array( '#type' => 'checkbox', - '#title' => t('Inherit'), - '#description' => t('Should this display inherit its paging values from the parent display to which it is attached?'), + '#title' => $this->t('Inherit'), + '#description' => $this->t('Should this display inherit its paging values from the parent display to which it is attached?'), '#default_value' => $this->getOption('inherit_pager'), ); break; case 'render_pager': - $form['#title'] .= t('Render pager'); + $form['#title'] .= $this->t('Render pager'); $form['render_pager'] = array( '#type' => 'checkbox', - '#title' => t('Render'), - '#description' => t('Should this display render the pager values? This is only meaningful if inheriting a pager.'), + '#title' => $this->t('Render'), + '#description' => $this->t('Should this display render the pager values? This is only meaningful if inheriting a pager.'), '#default_value' => $this->getOption('render_pager'), ); break; case 'attachment_position': - $form['#title'] .= t('Position'); + $form['#title'] .= $this->t('Position'); $form['attachment_position'] = array( - '#title' => t('Position'), + '#title' => $this->t('Position'), '#type' => 'radios', - '#description' => t('Attach before or after the parent display?'), + '#description' => $this->t('Attach before or after the parent display?'), '#options' => $this->attachmentPositions(), '#default_value' => $this->getOption('attachment_position'), ); break; case 'displays': - $form['#title'] .= t('Attach to'); + $form['#title'] .= $this->t('Attach to'); $displays = array(); foreach ($this->view->storage->get('display') as $display_id => $display) { if ($this->view->displayHandlers->has($display_id) && $this->view->displayHandlers->get($display_id)->acceptAttachments()) { @@ -201,9 +201,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } } $form['displays'] = array( - '#title' => t('Displays'), + '#title' => $this->t('Displays'), '#type' => 'checkboxes', - '#description' => t('Select which display or displays this should attach to.'), + '#description' => $this->t('Select which display or displays this should attach to.'), '#options' => $displays, '#default_value' => $this->getOption('displays'), ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/display/Block.php +++ b/core/modules/views/src/Plugin/views/display/Block.php @@ -96,7 +96,7 @@ public function optionsSummary(&$categories, &$options) { parent::optionsSummary($categories, $options); $categories['block'] = array( - 'title' => t('Block settings'), + 'title' => $this->t('Block settings'), 'column' => 'second', 'build' => array( '#weight' => -10, @@ -105,18 +105,18 @@ public function optionsSummary(&$categories, &$options) { $block_description = strip_tags($this->getOption('block_description')); if (empty($block_description)) { - $block_description = t('None'); + $block_description = $this->t('None'); } $block_category = String::checkPlain($this->getOption('block_category')); $options['block_description'] = array( 'category' => 'block', - 'title' => t('Block name'), + 'title' => $this->t('Block name'), 'value' => views_ui_truncate($block_description, 24), ); $options['block_category'] = array( 'category' => 'block', - 'title' => t('Block category'), + 'title' => $this->t('Block category'), 'value' => views_ui_truncate($block_category, 24), ); @@ -124,14 +124,14 @@ public function optionsSummary(&$categories, &$options) { $options['allow'] = array( 'category' => 'block', - 'title' => t('Allow settings'), - 'value' => empty($filtered_allow) ? t('None') : t('Items per page'), + 'title' => $this->t('Allow settings'), + 'value' => empty($filtered_allow) ? $this->t('None') : $this->t('Items per page'), ); $options['block_hide_empty'] = array( 'category' => 'other', - 'title' => t('Hide block if the view output is empty'), - 'value' => $this->getOption('block_hide_empty') ? t('Hide') : t('Show'), + 'title' => $this->t('Hide block if the view output is empty'), + 'value' => $this->getOption('block_hide_empty') ? $this->t('Hide') : $this->t('Show'), ); } @@ -143,29 +143,29 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'block_description': - $form['#title'] .= t('Block admin description'); + $form['#title'] .= $this->t('Block admin description'); $form['block_description'] = array( '#type' => 'textfield', - '#description' => t('This will appear as the name of this block in administer >> structure >> blocks.'), + '#description' => $this->t('This will appear as the name of this block in administer >> structure >> blocks.'), '#default_value' => $this->getOption('block_description'), ); break; case 'block_category': - $form['#title'] .= t('Block category'); + $form['#title'] .= $this->t('Block category'); $form['block_category'] = array( '#type' => 'textfield', '#autocomplete_route_name' => 'block.category_autocomplete', - '#description' => t('The category this block will appear under on the blocks placement page.', array('@href' => url('admin/structure/block'))), + '#description' => $this->t('The category this block will appear under on the blocks placement page.', array('@href' => url('admin/structure/block'))), '#default_value' => $this->getOption('block_category'), ); break; case 'block_hide_empty': - $form['#title'] .= t('Block empty settings'); + $form['#title'] .= $this->t('Block empty settings'); $form['block_hide_empty'] = array( - '#title' => t('Hide block if no result/empty text'), + '#title' => $this->t('Hide block if no result/empty text'), '#type' => 'checkbox', - '#description' => t('Hide the block if there is no result and no empty text and no header/footer which is shown on empty result'), + '#description' => $this->t('Hide the block if there is no result and no empty text and no header/footer which is shown on empty result'), '#default_value' => $this->getOption('block_hide_empty'), ); break; @@ -174,15 +174,15 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { if (!$this->usesExposed() && parent::usesExposed()) { $form['exposed_form_options']['warning'] = array( '#weight' => -10, - '#markup' => '
' . t('Exposed filters in block displays require "Use AJAX" to be set to work correctly.') . '
', + '#markup' => '
' . $this->t('Exposed filters in block displays require "Use AJAX" to be set to work correctly.') . '
', ); } break; case 'allow': - $form['#title'] .= t('Allow settings in the block configuration'); + $form['#title'] .= $this->t('Allow settings in the block configuration'); $options = array( - 'items_per_page' => t('Items per page'), + 'items_per_page' => $this->t('Items per page'), ); $allow = array_filter($this->getOption('allow')); @@ -242,9 +242,9 @@ public function blockForm(ViewsBlock $block, array &$form, FormStateInterface $f case 'items_per_page': $form['override']['items_per_page'] = array( '#type' => 'select', - '#title' => t('Items per block'), + '#title' => $this->t('Items per block'), '#options' => array( - 'none' => t('@count (default setting)', array('@count' => $this->getPlugin('pager')->getItemsPerPage())), + 'none' => $this->t('@count (default setting)', array('@count' => $this->getPlugin('pager')->getItemsPerPage())), 5 => 5, 10 => 10, 20 => 20, only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -1027,7 +1027,7 @@ public function optionLink($text, $section, $class = '', $title = '') { } if (!trim($text)) { - $text = t('Broken field'); + $text = $this->t('Broken field'); } if (empty($title)) { @@ -1072,27 +1072,27 @@ public function getArgumentsTokens() { public function optionsSummary(&$categories, &$options) { $categories = array( 'title' => array( - 'title' => t('Title'), + 'title' => $this->t('Title'), 'column' => 'first', ), 'format' => array( - 'title' => t('Format'), + 'title' => $this->t('Format'), 'column' => 'first', ), 'filters' => array( - 'title' => t('Filters'), + 'title' => $this->t('Filters'), 'column' => 'first', ), 'fields' => array( - 'title' => t('Fields'), + 'title' => $this->t('Fields'), 'column' => 'first', ), 'pager' => array( - 'title' => t('Pager'), + 'title' => $this->t('Pager'), 'column' => 'second', ), 'exposed' => array( - 'title' => t('Exposed form'), + 'title' => $this->t('Exposed form'), 'column' => 'third', 'build' => array( '#weight' => 1, @@ -1106,7 +1106,7 @@ public function optionsSummary(&$categories, &$options) { ), ), 'other' => array( - 'title' => t('Other'), + 'title' => $this->t('Other'), 'column' => 'third', 'build' => array( '#weight' => 2, @@ -1117,88 +1117,88 @@ public function optionsSummary(&$categories, &$options) { if ($this->display['id'] != 'default') { $options['display_id'] = array( 'category' => 'other', - 'title' => t('Machine Name'), + 'title' => $this->t('Machine Name'), 'value' => !empty($this->display['new_id']) ? String::checkPlain($this->display['new_id']) : String::checkPlain($this->display['id']), - 'desc' => t('Change the machine name of this display.'), + 'desc' => $this->t('Change the machine name of this display.'), ); } $display_comment = String::checkPlain(drupal_substr($this->getOption('display_comment'), 0, 10)); $options['display_comment'] = array( 'category' => 'other', - 'title' => t('Administrative comment'), - 'value' => !empty($display_comment) ? $display_comment : t('None'), - 'desc' => t('Comment or document this display.'), + 'title' => $this->t('Administrative comment'), + 'value' => !empty($display_comment) ? $display_comment : $this->t('None'), + 'desc' => $this->t('Comment or document this display.'), ); $title = strip_tags($this->getOption('title')); if (!$title) { - $title = t('None'); + $title = $this->t('None'); } $options['title'] = array( 'category' => 'title', - 'title' => t('Title'), + 'title' => $this->t('Title'), 'value' => views_ui_truncate($title, 32), - 'desc' => t('Change the title that this display will use.'), + 'desc' => $this->t('Change the title that this display will use.'), ); $style_plugin_instance = $this->getPlugin('style'); - $style_summary = empty($style_plugin_instance->definition['title']) ? t('Missing style plugin') : $style_plugin_instance->summaryTitle(); - $style_title = empty($style_plugin_instance->definition['title']) ? t('Missing style plugin') : $style_plugin_instance->pluginTitle(); + $style_summary = empty($style_plugin_instance->definition['title']) ? $this->t('Missing style plugin') : $style_plugin_instance->summaryTitle(); + $style_title = empty($style_plugin_instance->definition['title']) ? $this->t('Missing style plugin') : $style_plugin_instance->pluginTitle(); $options['style'] = array( 'category' => 'format', - 'title' => t('Format'), + 'title' => $this->t('Format'), 'value' => $style_title, 'setting' => $style_summary, - 'desc' => t('Change the way content is formatted.'), + 'desc' => $this->t('Change the way content is formatted.'), ); // This adds a 'Settings' link to the style_options setting if the style has options. if ($style_plugin_instance->usesOptions()) { - $options['style']['links']['style_options'] = t('Change settings for this format'); + $options['style']['links']['style_options'] = $this->t('Change settings for this format'); } if ($style_plugin_instance->usesRowPlugin()) { $row_plugin_instance = $this->getPlugin('row'); - $row_summary = empty($row_plugin_instance->definition['title']) ? t('Missing row plugin') : $row_plugin_instance->summaryTitle(); - $row_title = empty($row_plugin_instance->definition['title']) ? t('Missing row plugin') : $row_plugin_instance->pluginTitle(); + $row_summary = empty($row_plugin_instance->definition['title']) ? $this->t('Missing row plugin') : $row_plugin_instance->summaryTitle(); + $row_title = empty($row_plugin_instance->definition['title']) ? $this->t('Missing row plugin') : $row_plugin_instance->pluginTitle(); $options['row'] = array( 'category' => 'format', - 'title' => t('Show'), + 'title' => $this->t('Show'), 'value' => $row_title, 'setting' => $row_summary, - 'desc' => t('Change the way each row in the view is styled.'), + 'desc' => $this->t('Change the way each row in the view is styled.'), ); // This adds a 'Settings' link to the row_options setting if the row style has options. if ($row_plugin_instance->usesOptions()) { - $options['row']['links']['row_options'] = t('Change settings for this style'); + $options['row']['links']['row_options'] = $this->t('Change settings for this style'); } } if ($this->usesAJAX()) { $options['use_ajax'] = array( 'category' => 'other', - 'title' => t('Use AJAX'), - 'value' => $this->getOption('use_ajax') ? t('Yes') : t('No'), - 'desc' => t('Change whether or not this display will use AJAX.'), + 'title' => $this->t('Use AJAX'), + 'value' => $this->getOption('use_ajax') ? $this->t('Yes') : $this->t('No'), + 'desc' => $this->t('Change whether or not this display will use AJAX.'), ); } if ($this->usesAttachments()) { $options['hide_attachment_summary'] = array( 'category' => 'other', - 'title' => t('Hide attachments in summary'), - 'value' => $this->getOption('hide_attachment_summary') ? t('Yes') : t('No'), - 'desc' => t('Change whether or not to display attachments when displaying a contextual filter summary.'), + 'title' => $this->t('Hide attachments in summary'), + 'value' => $this->getOption('hide_attachment_summary') ? $this->t('Yes') : $this->t('No'), + 'desc' => $this->t('Change whether or not to display attachments when displaying a contextual filter summary.'), ); } if (!isset($this->definition['contextual links locations']) || !empty($this->definition['contextual links locations'])) { $options['show_admin_links'] = array( 'category' => 'other', - 'title' => t('Contextual links'), - 'value' => $this->getOption('show_admin_links') ? t('Shown') : t('Hidden'), - 'desc' => t('Change whether or not to display contextual links for this view.'), + 'title' => $this->t('Contextual links'), + 'value' => $this->getOption('show_admin_links') ? $this->t('Shown') : $this->t('Hidden'), + 'desc' => $this->t('Change whether or not to display contextual links for this view.'), ); } @@ -1212,27 +1212,27 @@ public function optionsSummary(&$categories, &$options) { $options['pager'] = array( 'category' => 'pager', - 'title' => t('Use pager'), + 'title' => $this->t('Use pager'), 'value' => $pager_plugin->pluginTitle(), 'setting' => $pager_str, - 'desc' => t("Change this display's pager setting."), + 'desc' => $this->t("Change this display's pager setting."), ); // If pagers aren't allowed, change the text of the item: if (!$this->usesPager()) { - $options['pager']['title'] = t('Items to display'); + $options['pager']['title'] = $this->t('Items to display'); } if ($pager_plugin->usesOptions()) { - $options['pager']['links']['pager_options'] = t('Change settings for this pager type.'); + $options['pager']['links']['pager_options'] = $this->t('Change settings for this pager type.'); } if ($this->usesMore()) { $options['use_more'] = array( 'category' => 'pager', - 'title' => t('More link'), - 'value' => $this->getOption('use_more') ? t('Yes') : t('No'), - 'desc' => t('Specify whether this display will provide a "more" link.'), + 'title' => $this->t('More link'), + 'value' => $this->getOption('use_more') ? $this->t('Yes') : $this->t('No'), + 'desc' => $this->t('Specify whether this display will provide a "more" link.'), ); } @@ -1240,26 +1240,26 @@ public function optionsSummary(&$categories, &$options) { if ($this->view->query->getAggregationInfo()) { $options['group_by'] = array( 'category' => 'other', - 'title' => t('Use aggregation'), - 'value' => $this->getOption('group_by') ? t('Yes') : t('No'), - 'desc' => t('Allow grouping and aggregation (calculation) of fields.'), + 'title' => $this->t('Use aggregation'), + 'value' => $this->getOption('group_by') ? $this->t('Yes') : $this->t('No'), + 'desc' => $this->t('Allow grouping and aggregation (calculation) of fields.'), ); } $options['query'] = array( 'category' => 'other', - 'title' => t('Query settings'), - 'value' => t('Settings'), - 'desc' => t('Allow to set some advanced settings for the query plugin'), + 'title' => $this->t('Query settings'), + 'value' => $this->t('Settings'), + 'desc' => $this->t('Allow to set some advanced settings for the query plugin'), ); $language_options = $this->listLanguages(LanguageInterface::STATE_ALL | LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED); $options['field_langcode'] = array( 'category' => 'other', - 'title' => t('Field Language'), + 'title' => $this->t('Field Language'), 'value' => $language_options[$this->getOption('field_langcode')], - 'desc' => t('All fields that support translations will be displayed in the selected language.'), + 'desc' => $this->t('All fields that support translations will be displayed in the selected language.'), ); $access_plugin = $this->getPlugin('access'); @@ -1272,14 +1272,14 @@ public function optionsSummary(&$categories, &$options) { $options['access'] = array( 'category' => 'access', - 'title' => t('Access'), + 'title' => $this->t('Access'), 'value' => $access_plugin->pluginTitle(), 'setting' => $access_str, - 'desc' => t('Specify access control type for this display.'), + 'desc' => $this->t('Specify access control type for this display.'), ); if ($access_plugin->usesOptions()) { - $options['access']['links']['access_options'] = t('Change settings for this access type.'); + $options['access']['links']['access_options'] = $this->t('Change settings for this access type.'); } $cache_plugin = $this->getPlugin('cache'); @@ -1292,18 +1292,18 @@ public function optionsSummary(&$categories, &$options) { $options['cache'] = array( 'category' => 'other', - 'title' => t('Caching'), + 'title' => $this->t('Caching'), 'value' => $cache_plugin->pluginTitle(), 'setting' => $cache_str, - 'desc' => t('Specify caching type for this display.'), + 'desc' => $this->t('Specify caching type for this display.'), ); if ($cache_plugin->usesOptions()) { - $options['cache']['links']['cache_options'] = t('Change settings for this caching type.'); + $options['cache']['links']['cache_options'] = $this->t('Change settings for this caching type.'); } if ($access_plugin->usesOptions()) { - $options['access']['links']['access_options'] = t('Change settings for this access type.'); + $options['access']['links']['access_options'] = $this->t('Change settings for this access type.'); } if ($this->usesLinkDisplay()) { @@ -1323,18 +1323,18 @@ public function optionsSummary(&$categories, &$options) { $options['link_display'] = array( 'category' => 'pager', - 'title' => t('Link display'), + 'title' => $this->t('Link display'), 'value' => $link_display, - 'desc' => t('Specify which display or custom url this display will link to.'), + 'desc' => $this->t('Specify which display or custom url this display will link to.'), ); } if ($this->usesExposedFormInBlock()) { $options['exposed_block'] = array( 'category' => 'exposed', - 'title' => t('Exposed form in block'), - 'value' => $this->getOption('exposed_block') ? t('Yes') : t('No'), - 'desc' => t('Allow the exposed form to appear in a block instead of the view.'), + 'title' => $this->t('Exposed form in block'), + 'value' => $this->getOption('exposed_block') ? $this->t('Yes') : $this->t('No'), + 'desc' => $this->t('Allow the exposed form to appear in a block instead of the view.'), ); } @@ -1348,26 +1348,26 @@ public function optionsSummary(&$categories, &$options) { $options['exposed_form'] = array( 'category' => 'exposed', - 'title' => t('Exposed form style'), + 'title' => $this->t('Exposed form style'), 'value' => $exposed_form_plugin->pluginTitle(), 'setting' => $exposed_form_str, - 'desc' => t('Select the kind of exposed filter to use.'), + 'desc' => $this->t('Select the kind of exposed filter to use.'), ); if ($exposed_form_plugin->usesOptions()) { - $options['exposed_form']['links']['exposed_form_options'] = t('Exposed form settings for this exposed form style.'); + $options['exposed_form']['links']['exposed_form_options'] = $this->t('Exposed form settings for this exposed form style.'); } $css_class = String::checkPlain(trim($this->getOption('css_class'))); if (!$css_class) { - $css_class = t('None'); + $css_class = $this->t('None'); } $options['css_class'] = array( 'category' => 'other', - 'title' => t('CSS class'), + 'title' => $this->t('CSS class'), 'value' => $css_class, - 'desc' => t('Change the CSS class name(s) that will be added to this display.'), + 'desc' => $this->t('Change the CSS class name(s) that will be added to this display.'), ); foreach ($this->extender as $extender) { @@ -1399,93 +1399,93 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { switch ($section) { case 'display_id': - $form['#title'] .= t('The machine name of this display'); + $form['#title'] .= $this->t('The machine name of this display'); $form['display_id'] = array( '#type' => 'textfield', - '#title' => t('Machine name of the display'), + '#title' => $this->t('Machine name of the display'), '#default_value' => !empty($this->display['new_id']) ? $this->display['new_id'] : $this->display['id'], '#required' => TRUE, '#size' => 64, ); break; case 'display_title': - $form['#title'] .= t('The name and the description of this display'); + $form['#title'] .= $this->t('The name and the description of this display'); $form['display_title'] = array( - '#title' => t('Administrative name'), + '#title' => $this->t('Administrative name'), '#type' => 'textfield', '#default_value' => $this->display['display_title'], ); $form['display_description'] = array( - '#title' => t('Administrative description'), + '#title' => $this->t('Administrative description'), '#type' => 'textfield', '#default_value' => $this->getOption('display_description'), ); break; case 'display_comment': - $form['#title'] .= t('Administrative comment'); + $form['#title'] .= $this->t('Administrative comment'); $form['display_comment'] = array( '#type' => 'textarea', - '#title' => t('Administrative comment'), - '#description' => t('This description will only be seen within the administrative interface and can be used to document this display.'), + '#title' => $this->t('Administrative comment'), + '#description' => $this->t('This description will only be seen within the administrative interface and can be used to document this display.'), '#default_value' => $this->getOption('display_comment'), ); break; case 'title': - $form['#title'] .= t('The title of this view'); + $form['#title'] .= $this->t('The title of this view'); $form['title'] = array( - '#title' => t('Title'), + '#title' => $this->t('Title'), '#type' => 'textfield', - '#description' => t('This title will be displayed with the view, wherever titles are normally displayed; i.e, as the page title, block title, etc.'), + '#description' => $this->t('This title will be displayed with the view, wherever titles are normally displayed; i.e, as the page title, block title, etc.'), '#default_value' => $this->getOption('title'), '#maxlength' => 255, ); break; case 'css_class': - $form['#title'] .= t('CSS class'); + $form['#title'] .= $this->t('CSS class'); $form['css_class'] = array( '#type' => 'textfield', - '#title' => t('CSS class name(s)'), - '#description' => t('Multiples classes should be separated by spaces.'), + '#title' => $this->t('CSS class name(s)'), + '#description' => $this->t('Multiples classes should be separated by spaces.'), '#default_value' => $this->getOption('css_class'), ); break; case 'use_ajax': - $form['#title'] .= t('Use AJAX when available to load this view'); + $form['#title'] .= $this->t('Use AJAX when available to load this view'); $form['use_ajax'] = array( - '#description' => t('When viewing a view, things like paging, table sorting, and exposed filters will not trigger a page refresh.'), + '#description' => $this->t('When viewing a view, things like paging, table sorting, and exposed filters will not trigger a page refresh.'), '#type' => 'checkbox', - '#title' => t('Use AJAX'), + '#title' => $this->t('Use AJAX'), '#default_value' => $this->getOption('use_ajax') ? 1 : 0, ); break; case 'hide_attachment_summary': - $form['#title'] .= t('Hide attachments when displaying a contextual filter summary'); + $form['#title'] .= $this->t('Hide attachments when displaying a contextual filter summary'); $form['hide_attachment_summary'] = array( '#type' => 'checkbox', - '#title' => t('Hide attachments in summary'), + '#title' => $this->t('Hide attachments in summary'), '#default_value' => $this->getOption('hide_attachment_summary') ? 1 : 0, ); break; case 'show_admin_links': - $form['#title'] .= t('Show contextual links on this view.'); + $form['#title'] .= $this->t('Show contextual links on this view.'); $form['show_admin_links'] = array( '#type' => 'checkbox', - '#title' => t('Show contextual links'), + '#title' => $this->t('Show contextual links'), '#default_value' => $this->getOption('show_admin_links'), ); break; case 'use_more': - $form['#title'] .= t('Add a more link to the bottom of the display.'); + $form['#title'] .= $this->t('Add a more link to the bottom of the display.'); $form['use_more'] = array( '#type' => 'checkbox', - '#title' => t('Create more link'), - '#description' => t("This will add a more link to the bottom of this view, which will link to the page view. If you have more than one page view, the link will point to the display specified in 'Link display' section under pager. You can override the url at the link display setting."), + '#title' => $this->t('Create more link'), + '#description' => $this->t("This will add a more link to the bottom of this view, which will link to the page view. If you have more than one page view, the link will point to the display specified in 'Link display' section under pager. You can override the url at the link display setting."), '#default_value' => $this->getOption('use_more'), ); $form['use_more_always'] = array( '#type' => 'checkbox', - '#title' => t('Always display the more link'), - '#description' => t('Check this to display the more link even if there are no more items to display.'), + '#title' => $this->t('Always display the more link'), + '#description' => $this->t('Check this to display the more link even if there are no more items to display.'), '#default_value' => $this->getOption('use_more_always'), '#states' => array( 'visible' => array( @@ -1495,8 +1495,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['use_more_text'] = array( '#type' => 'textfield', - '#title' => t('More link text'), - '#description' => t('The text to display for the more link.'), + '#title' => $this->t('More link text'), + '#description' => $this->t('The text to display for the more link.'), '#default_value' => $this->getOption('use_more_text'), '#states' => array( 'visible' => array( @@ -1506,16 +1506,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); break; case 'group_by': - $form['#title'] .= t('Allow grouping and aggregation (calculation) of fields.'); + $form['#title'] .= $this->t('Allow grouping and aggregation (calculation) of fields.'); $form['group_by'] = array( '#type' => 'checkbox', - '#title' => t('Aggregate'), - '#description' => t('If enabled, some fields may become unavailable. All fields that are selected for grouping will be collapsed to one record per distinct value. Other fields which are selected for aggregation will have the function run on them. For example, you can group nodes on title and count the number of nids in order to get a list of duplicate titles.'), + '#title' => $this->t('Aggregate'), + '#description' => $this->t('If enabled, some fields may become unavailable. All fields that are selected for grouping will be collapsed to one record per distinct value. Other fields which are selected for aggregation will have the function run on them. For example, you can group nodes on title and count the number of nids in order to get a list of duplicate titles.'), '#default_value' => $this->getOption('group_by'), ); break; case 'access': - $form['#title'] .= t('Access restrictions'); + $form['#title'] .= $this->t('Access restrictions'); $form['access'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1524,7 +1524,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $access = $this->getOption('access'); $form['access']['type'] = array( - '#title' => t('Access'), + '#title' => $this->t('Access'), '#title_display' => 'invisible', '#type' => 'radios', '#options' => Views::fetchPluginNames('access', $this->getType(), array($this->view->storage->get('base_table'))), @@ -1535,7 +1535,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { if ($access_plugin->usesOptions()) { $form['markup'] = array( '#prefix' => '
', - '#markup' => t('You may also adjust the !settings for the currently selected access restriction.', array('!settings' => $this->optionLink(t('settings'), 'access_options'))), + '#markup' => $this->t('You may also adjust the !settings for the currently selected access restriction.', array('!settings' => $this->optionLink(t('settings'), 'access_options'))), '#suffix' => '
', ); } @@ -1543,7 +1543,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { break; case 'access_options': $plugin = $this->getPlugin('access'); - $form['#title'] .= t('Access options'); + $form['#title'] .= $this->t('Access options'); if ($plugin) { $form['access_options'] = array( '#tree' => TRUE, @@ -1552,7 +1552,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } break; case 'cache': - $form['#title'] .= t('Caching'); + $form['#title'] .= $this->t('Caching'); $form['cache'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1561,7 +1561,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $cache = $this->getOption('cache'); $form['cache']['type'] = array( - '#title' => t('Caching'), + '#title' => $this->t('Caching'), '#title_display' => 'invisible', '#type' => 'radios', '#options' => Views::fetchPluginNames('cache', $this->getType(), array($this->view->storage->get('base_table'))), @@ -1573,13 +1573,13 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['markup'] = array( '#prefix' => '
', '#suffix' => '
', - '#markup' => t('You may also adjust the !settings for the currently selected cache mechanism.', array('!settings' => $this->optionLink(t('settings'), 'cache_options'))), + '#markup' => $this->t('You may also adjust the !settings for the currently selected cache mechanism.', array('!settings' => $this->optionLink(t('settings'), 'cache_options'))), ); } break; case 'cache_options': $plugin = $this->getPlugin('cache'); - $form['#title'] .= t('Caching options'); + $form['#title'] .= $this->t('Caching options'); if ($plugin) { $form['cache_options'] = array( '#tree' => TRUE, @@ -1591,7 +1591,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $query_options = $this->getOption('query'); $plugin_name = $query_options['type']; - $form['#title'] .= t('Query options'); + $form['#title'] .= $this->t('Query options'); $this->view->initQuery(); if ($this->view->query) { $form['query'] = array( @@ -1609,7 +1609,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } break; case 'field_langcode': - $form['#title'] .= t('Field Language'); + $form['#title'] .= $this->t('Field Language'); $translatable_entity_tables = array(); foreach (\Drupal::entityManager()->getDefinitions() as $entity_type) { @@ -1626,23 +1626,23 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['field_langcode'] = array( '#type' => 'select', - '#title' => t('Field Language'), - '#description' => t('All fields which support translations will be displayed in the selected language.'), + '#title' => $this->t('Field Language'), + '#description' => $this->t('All fields which support translations will be displayed in the selected language.'), '#options' => $languages, '#default_value' => $this->getOption('field_langcode'), ); $form['field_langcode_add_to_query'] = array( '#type' => 'checkbox', - '#title' => t('When needed, add the field language condition to the query'), + '#title' => $this->t('When needed, add the field language condition to the query'), '#default_value' => $this->getOption('field_langcode_add_to_query'), ); } else { - $form['field_language']['#markup'] = t("You don't have translatable entity types."); + $form['field_language']['#markup'] = $this->t("You don't have translatable entity types."); } break; case 'style': - $form['#title'] .= t('How should this view be styled'); + $form['#title'] .= $this->t('How should this view be styled'); $style_plugin = $this->getPlugin('style'); $form['style'] = array( '#prefix' => '
', @@ -1650,25 +1650,25 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#tree' => TRUE, ); $form['style']['type'] = array( - '#title' => t('Style'), + '#title' => $this->t('Style'), '#title_display' => 'invisible', '#type' => 'radios', '#options' => Views::fetchPluginNames('style', $this->getType(), array($this->view->storage->get('base_table'))), '#default_value' => $style_plugin->definition['id'], - '#description' => t('If the style you choose has settings, be sure to click the settings button that will appear next to it in the View summary.'), + '#description' => $this->t('If the style you choose has settings, be sure to click the settings button that will appear next to it in the View summary.'), ); if ($style_plugin->usesOptions()) { $form['markup'] = array( '#prefix' => '
', '#suffix' => '
', - '#markup' => t('You may also adjust the !settings for the currently selected style.', array('!settings' => $this->optionLink(t('settings'), 'style_options'))), + '#markup' => $this->t('You may also adjust the !settings for the currently selected style.', array('!settings' => $this->optionLink(t('settings'), 'style_options'))), ); } break; case 'style_options': - $form['#title'] .= t('Style options'); + $form['#title'] .= $this->t('Style options'); $style = TRUE; $style_plugin = $this->getOption('style'); $name = $style_plugin['type']; @@ -1680,7 +1680,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } // if row, $style will be empty. if (empty($style)) { - $form['#title'] .= t('Row style options'); + $form['#title'] .= $this->t('Row style options'); } $plugin = $this->getPlugin(empty($style) ? 'row' : 'style', $name); if ($plugin) { @@ -1691,7 +1691,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } break; case 'row': - $form['#title'] .= t('How should each row in this view be styled'); + $form['#title'] .= $this->t('How should each row in this view be styled'); $row_plugin_instance = $this->getPlugin('row'); $form['row'] = array( '#prefix' => '
', @@ -1699,7 +1699,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#tree' => TRUE, ); $form['row']['type'] = array( - '#title' => t('Row'), + '#title' => $this->t('Row'), '#title_display' => 'invisible', '#type' => 'radios', '#options' => Views::fetchPluginNames('row', $this->getType(), array($this->view->storage->get('base_table'))), @@ -1710,13 +1710,13 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['markup'] = array( '#prefix' => '
', '#suffix' => '
', - '#markup' => t('You may also adjust the !settings for the currently selected row style.', array('!settings' => $this->optionLink(t('settings'), 'row_options'))), + '#markup' => $this->t('You may also adjust the !settings for the currently selected row style.', array('!settings' => $this->optionLink(t('settings'), 'row_options'))), ); } break; case 'link_display': - $form['#title'] .= t('Which display to use for path'); + $form['#title'] .= $this->t('Which display to use for path'); $options = array(FALSE => $this->t('None'), 'custom_url' => $this->t('Custom URL')); foreach ($this->view->storage->get('display') as $display_id => $display) { @@ -1728,22 +1728,22 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_display'] = array( '#type' => 'radios', '#options' => $options, - '#description' => t("Which display to use to get this display's path for things like summary links, rss feed links, more links, etc."), + '#description' => $this->t("Which display to use to get this display's path for things like summary links, rss feed links, more links, etc."), '#default_value' => $this->getOption('link_display'), ); $options = array(); $count = 0; // This lets us prepare the key as we want it printed. foreach ($this->view->display_handler->getHandlers('argument') as $handler) { - $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->adminLabel())); - $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->adminLabel())); + $options[t('Arguments')]['%' . ++$count] = $this->t('@argument title', array('@argument' => $handler->adminLabel())); + $options[t('Arguments')]['!' . $count] = $this->t('@argument input', array('@argument' => $handler->adminLabel())); } // Default text. // We have some options, so make a list. $output = ''; if (!empty($options)) { - $output = t('

The following tokens are available for this link.

'); + $output = $this->t('

The following tokens are available for this link.

'); foreach (array_keys($options) as $type) { if (!empty($options[$type])) { $items = array(); @@ -1762,9 +1762,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_url'] = array( '#type' => 'textfield', - '#title' => t('Custom URL'), + '#title' => $this->t('Custom URL'), '#default_value' => $this->getOption('link_url'), - '#description' => t('A Drupal path or external URL the more link will point to. Note that this will override the link display setting above.') . $output, + '#description' => $this->t('A Drupal path or external URL the more link will point to. Note that this will override the link display setting above.') . $output, '#states' => array( 'visible' => array( ':input[name="link_display"]' => array('value' => 'custom_url'), @@ -1773,18 +1773,18 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); break; case 'exposed_block': - $form['#title'] .= t('Put the exposed form in a block'); + $form['#title'] .= $this->t('Put the exposed form in a block'); $form['description'] = array( - '#markup' => '
' . t('If set, any exposed widgets will not appear with this view. Instead, a block will be made available to the Drupal block administration system, and the exposed form will appear there. Note that this block must be enabled manually, Views will not enable it for you.') . '
', + '#markup' => '
' . $this->t('If set, any exposed widgets will not appear with this view. Instead, a block will be made available to the Drupal block administration system, and the exposed form will appear there. Note that this block must be enabled manually, Views will not enable it for you.') . '
', ); $form['exposed_block'] = array( '#type' => 'radios', - '#options' => array(1 => t('Yes'), 0 => t('No')), + '#options' => array(1 => $this->t('Yes'), 0 => $this->t('No')), '#default_value' => $this->getOption('exposed_block') ? 1 : 0, ); break; case 'exposed_form': - $form['#title'] .= t('Exposed Form'); + $form['#title'] .= $this->t('Exposed Form'); $form['exposed_form'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1793,7 +1793,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $exposed_form = $this->getOption('exposed_form'); $form['exposed_form']['type'] = array( - '#title' => t('Exposed form'), + '#title' => $this->t('Exposed form'), '#title_display' => 'invisible', '#type' => 'radios', '#options' => Views::fetchPluginNames('exposed_form', $this->getType(), array($this->view->storage->get('base_table'))), @@ -1805,13 +1805,13 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['markup'] = array( '#prefix' => '
', '#suffix' => '
', - '#markup' => t('You may also adjust the !settings for the currently selected style.', array('!settings' => $this->optionLink(t('settings'), 'exposed_form_options'))), + '#markup' => $this->t('You may also adjust the !settings for the currently selected style.', array('!settings' => $this->optionLink(t('settings'), 'exposed_form_options'))), ); } break; case 'exposed_form_options': $plugin = $this->getPlugin('exposed_form'); - $form['#title'] .= t('Exposed form options'); + $form['#title'] .= $this->t('Exposed form options'); if ($plugin) { $form['exposed_form_options'] = array( '#tree' => TRUE, @@ -1820,7 +1820,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } break; case 'pager': - $form['#title'] .= t('Select which pager, if any, to use for this view'); + $form['#title'] .= $this->t('Select which pager, if any, to use for this view'); $form['pager'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1829,7 +1829,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $pager = $this->getOption('pager'); $form['pager']['type'] = array( - '#title' => t('Pager'), + '#title' => $this->t('Pager'), '#title_display' => 'invisible', '#type' => 'radios', '#options' => Views::fetchPluginNames('pager', !$this->usesPager() ? 'basic' : NULL, array($this->view->storage->get('base_table'))), @@ -1841,14 +1841,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['markup'] = array( '#prefix' => '
', '#suffix' => '
', - '#markup' => t('You may also adjust the !settings for the currently selected pager.', array('!settings' => $this->optionLink(t('settings'), 'pager_options'))), + '#markup' => $this->t('You may also adjust the !settings for the currently selected pager.', array('!settings' => $this->optionLink(t('settings'), 'pager_options'))), ); } break; case 'pager_options': $plugin = $this->getPlugin('pager'); - $form['#title'] .= t('Pager options'); + $form['#title'] .= $this->t('Pager options'); if ($plugin) { $form['pager_options'] = array( '#tree' => TRUE, @@ -1871,24 +1871,24 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { switch ($section) { case 'display_title': if ($form_state->isValueEmpty('display_title')) { - $form_state->setError($form['display_title'], t('Display title may not be empty.')); + $form_state->setError($form['display_title'], $this->t('Display title may not be empty.')); } break; case 'css_class': $css_class = $form_state->getValue('css_class'); if (preg_match('/[^a-zA-Z0-9-_ ]/', $css_class)) { - $form_state->setError($form['css_class'], t('CSS classes must be alphanumeric or dashes only.')); + $form_state->setError($form['css_class'], $this->t('CSS classes must be alphanumeric or dashes only.')); } break; case 'display_id': if ($form_state->getValue('display_id')) { if (preg_match('/[^a-z0-9_]/', $form_state->getValue('display_id'))) { - $form_state->setError($form['display_id'], t('Display name must be letters, numbers, or underscores only.')); + $form_state->setError($form['display_id'], $this->t('Display name must be letters, numbers, or underscores only.')); } foreach ($this->view->displayHandlers as $id => $display) { if ($id != $this->view->current_display && ($form_state->getValue('display_id') == $id || (isset($display->new_id) && $form_state->getValue('display_id') == $display->new_id))) { - $form_state->setError($form['display_id'], t('Display id should be unique.')); + $form_state->setError($form['display_id'], $this->t('Display id should be unique.')); } } } @@ -2337,18 +2337,18 @@ public function validate() { } if (!$fields) { - $errors[] = t('Display "@display" uses fields but there are none defined for it or all are excluded.', array('@display' => $this->display['display_title'])); + $errors[] = $this->t('Display "@display" uses fields but there are none defined for it or all are excluded.', array('@display' => $this->display['display_title'])); } } if ($this->hasPath() && !$this->getOption('path')) { - $errors[] = t('Display "@display" uses a path but the path is undefined.', array('@display' => $this->display['display_title'])); + $errors[] = $this->t('Display "@display" uses a path but the path is undefined.', array('@display' => $this->display['display_title'])); } // Validate style plugin $style = $this->getPlugin('style'); if (empty($style)) { - $errors[] = t('Display "@display" has an invalid style plugin.', array('@display' => $this->display['display_title'])); + $errors[] = $this->t('Display "@display" has an invalid style plugin.', array('@display' => $this->display['display_title'])); } else { $result = $style->validate(); @@ -2459,7 +2459,7 @@ public function getSpecialBlocks() { if ($this->usesExposedFormInBlock()) { $delta = '-exp-' . $this->view->storage->id() . '-' . $this->display['id']; - $desc = t('Exposed form: @view-@display_id', array('@view' => $this->view->storage->id(), '@display_id' => $this->display['id'])); + $desc = $this->t('Exposed form: @view-@display_id', array('@view' => $this->view->storage->id(), '@display_id' => $this->display['id'])); $blocks[$delta] = array( 'info' => $desc, @@ -2502,9 +2502,9 @@ public function viewExposedFormBlocks() { */ public function getArgumentText() { return array( - 'filter value not present' => t('When the filter value is NOT available'), - 'filter value present' => t('When the filter value IS available or a default is provided'), - 'description' => t("This display does not have a source for contextual filters, so no contextual filter value will be available unless you select 'Provide default'."), + 'filter value not present' => $this->t('When the filter value is NOT available'), + 'filter value present' => $this->t('When the filter value IS available or a default is provided'), + 'description' => $this->t("This display does not have a source for contextual filters, so no contextual filter value will be available unless you select 'Provide default'."), ); } @@ -2516,8 +2516,8 @@ public function getArgumentText() { */ public function getPagerText() { return array( - 'items per page title' => t('Items to display'), - 'items per page description' => t('Enter 0 for no limit.') + 'items per page title' => $this->t('Items to display'), + 'items per page description' => $this->t('Enter 0 for no limit.') ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/display/Feed.php +++ b/core/modules/views/src/Plugin/views/display/Feed.php @@ -157,7 +157,7 @@ public function optionsSummary(&$categories, &$options) { // Since we're childing off the 'path' type, we'll still *call* our // category 'page' but let's override it so it says feed settings. $categories['page'] = array( - 'title' => t('Feed settings'), + 'title' => $this->t('Feed settings'), 'column' => 'second', 'build' => array( '#weight' => -10, @@ -165,12 +165,12 @@ public function optionsSummary(&$categories, &$options) { ); if ($this->getOption('sitename_title')) { - $options['title']['value'] = t('Using the site name'); + $options['title']['value'] = $this->t('Using the site name'); } $displays = array_filter($this->getOption('displays')); if (count($displays) > 1) { - $attach_to = t('Multiple displays'); + $attach_to = $this->t('Multiple displays'); } elseif (count($displays) == 1) { $display = array_shift($displays); @@ -181,12 +181,12 @@ public function optionsSummary(&$categories, &$options) { } if (!isset($attach_to)) { - $attach_to = t('None'); + $attach_to = $this->t('None'); } $options['displays'] = array( 'category' => 'page', - 'title' => t('Attach to'), + 'title' => $this->t('Attach to'), 'value' => $attach_to, ); } @@ -205,7 +205,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { unset($form['title']); $form['sitename_title'] = array( '#type' => 'checkbox', - '#title' => t('Use the site name for the title'), + '#title' => $this->t('Use the site name for the title'), '#default_value' => $this->getOption('sitename_title'), ); $form['title'] = $title; @@ -216,7 +216,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); break; case 'displays': - $form['#title'] .= t('Attach to'); + $form['#title'] .= $this->t('Attach to'); $displays = array(); foreach ($this->view->storage->get('display') as $display_id => $display) { // @todo The display plugin should have display_title and id as well. @@ -225,15 +225,15 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } } $form['displays'] = array( - '#title' => t('Displays'), + '#title' => $this->t('Displays'), '#type' => 'checkboxes', - '#description' => t('The feed icon will be available only to the selected displays.'), + '#description' => $this->t('The feed icon will be available only to the selected displays.'), '#options' => $displays, '#default_value' => $this->getOption('displays'), ); break; case 'path': - $form['path']['#description'] = t('This view will be displayed by visiting this path on your site. It is recommended that the path be something like "path/%/%/feed" or "path/%/%/rss.xml", putting one % in the path for each contextual filter you have defined in the view.'); + $form['path']['#description'] = $this->t('This view will be displayed by visiting this path on your site. It is recommended that the path be something like "path/%/%/feed" or "path/%/%/rss.xml", putting one % in the path for each contextual filter you have defined in the view.'); } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/display/Page.php +++ b/core/modules/views/src/Plugin/views/display/Page.php @@ -122,28 +122,28 @@ public function optionsSummary(&$categories, &$options) { switch ($menu['type']) { case 'none': default: - $menu_str = t('No menu'); + $menu_str = $this->t('No menu'); break; case 'normal': - $menu_str = t('Normal: @title', array('@title' => $menu['title'])); + $menu_str = $this->t('Normal: @title', array('@title' => $menu['title'])); break; case 'tab': case 'default tab': - $menu_str = t('Tab: @title', array('@title' => $menu['title'])); + $menu_str = $this->t('Tab: @title', array('@title' => $menu['title'])); break; } $options['menu'] = array( 'category' => 'page', - 'title' => t('Menu'), + 'title' => $this->t('Menu'), 'value' => views_ui_truncate($menu_str, 24), ); // This adds a 'Settings' link to the style_options setting if the style // has options. if ($menu['type'] == 'default tab') { - $options['menu']['setting'] = t('Parent menu item'); - $options['menu']['links']['tab_options'] = t('Change settings for the parent menu'); + $options['menu']['setting'] = $this->t('Parent menu item'); + $options['menu']['links']['tab_options'] = $this->t('Change settings for the parent menu'); } } @@ -155,7 +155,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'menu': - $form['#title'] .= t('Menu item entry'); + $form['#title'] .= $this->t('Menu item entry'); $form['menu'] = array( '#prefix' => '
', '#suffix' => '
', @@ -168,20 +168,20 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['menu']['type'] = array( '#prefix' => '
', '#suffix' => '
', - '#title' => t('Type'), + '#title' => $this->t('Type'), '#type' => 'radios', '#options' => array( - 'none' => t('No menu entry'), - 'normal' => t('Normal menu entry'), - 'tab' => t('Menu tab'), - 'default tab' => t('Default menu tab') + 'none' => $this->t('No menu entry'), + 'normal' => $this->t('Normal menu entry'), + 'tab' => $this->t('Menu tab'), + 'default tab' => $this->t('Default menu tab') ), '#default_value' => $menu['type'], ); $form['menu']['title'] = array( '#prefix' => '
', - '#title' => t('Menu link title'), + '#title' => $this->t('Menu link title'), '#type' => 'textfield', '#default_value' => $menu['title'], '#states' => array( @@ -199,10 +199,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['menu']['description'] = array( - '#title' => t('Description'), + '#title' => $this->t('Description'), '#type' => 'textfield', '#default_value' => $menu['description'], - '#description' => t("Shown when hovering over the menu link."), + '#description' => $this->t("Shown when hovering over the menu link."), '#states' => array( 'visible' => array( array( @@ -244,14 +244,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#value' => $menu_parent, ); $form['menu']['markup'] = array( - '#markup' => t('Menu selection requires the activation of Menu UI module.'), + '#markup' => $this->t('Menu selection requires the activation of Menu UI module.'), ); } $form['menu']['weight'] = array( - '#title' => t('Weight'), + '#title' => $this->t('Weight'), '#type' => 'textfield', '#default_value' => isset($menu['weight']) ? $menu['weight'] : 0, - '#description' => t('In the menu, the heavier links will sink and the lighter links will be positioned nearer the top.'), + '#description' => $this->t('In the menu, the heavier links will sink and the lighter links will be positioned nearer the top.'), '#states' => array( 'visible' => array( array( @@ -267,11 +267,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['menu']['context'] = array( - '#title' => t('Context'), + '#title' => $this->t('Context'), '#suffix' => '
', '#type' => 'checkbox', '#default_value' => !empty($menu['context']), - '#description' => t('Displays the link in contextual links'), + '#description' => $this->t('Displays the link in contextual links'), '#states' => array( 'visible' => array( ':input[name="menu[type]"]' => array('value' => 'tab'), @@ -280,14 +280,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); break; case 'tab_options': - $form['#title'] .= t('Default tab options'); + $form['#title'] .= $this->t('Default tab options'); $tab_options = $this->getOption('tab_options'); if (empty($tab_options)) { $tab_options = array('type' => 'none', 'title' => '', 'weight' => 0); } $form['tab_markup'] = array( - '#markup' => '
' . t('When providing a menu item as a tab, Drupal needs to know what the parent menu item of that tab will be. Sometimes the parent will already exist, but other times you will need to have one created. The path of a parent item will always be the same path with the last part left off. i.e, if the path to this view is foo/bar/baz, the parent path would be foo/bar.') . '
', + '#markup' => '
' . $this->t('When providing a menu item as a tab, Drupal needs to know what the parent menu item of that tab will be. Sometimes the parent will already exist, but other times you will need to have one created. The path of a parent item will always be the same path with the last part left off. i.e, if the path to this view is foo/bar/baz, the parent path would be foo/bar.') . '
', ); $form['tab_options'] = array( @@ -298,17 +298,17 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['tab_options']['type'] = array( '#prefix' => '
', '#suffix' => '
', - '#title' => t('Parent menu item'), + '#title' => $this->t('Parent menu item'), '#type' => 'radios', - '#options' => array('none' => t('Already exists'), 'normal' => t('Normal menu item'), 'tab' => t('Menu tab')), + '#options' => array('none' => $this->t('Already exists'), 'normal' => $this->t('Normal menu item'), 'tab' => $this->t('Menu tab')), '#default_value' => $tab_options['type'], ); $form['tab_options']['title'] = array( '#prefix' => '
', - '#title' => t('Title'), + '#title' => $this->t('Title'), '#type' => 'textfield', '#default_value' => $tab_options['title'], - '#description' => t('If creating a parent menu item, enter the title of the item.'), + '#description' => $this->t('If creating a parent menu item, enter the title of the item.'), '#states' => array( 'visible' => array( array( @@ -321,10 +321,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['tab_options']['description'] = array( - '#title' => t('Description'), + '#title' => $this->t('Description'), '#type' => 'textfield', '#default_value' => $tab_options['description'], - '#description' => t('If creating a parent menu item, enter the description of the item.'), + '#description' => $this->t('If creating a parent menu item, enter the description of the item.'), '#states' => array( 'visible' => array( array( @@ -339,11 +339,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // Only display the menu selector if Menu UI module is enabled. if (\Drupal::moduleHandler()->moduleExists('menu_ui')) { $form['tab_options']['name'] = array( - '#title' => t('Menu'), + '#title' => $this->t('Menu'), '#type' => 'select', '#options' => menu_ui_get_menus(), '#default_value' => $tab_options['name'], - '#description' => t('Insert item into an available menu.'), + '#description' => $this->t('Insert item into an available menu.'), '#states' => array( 'visible' => array( ':input[name="tab_options[type]"]' => array('value' => 'normal'), @@ -357,16 +357,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#value' => $tab_options['menu_name'], ); $form['tab_options']['markup'] = array( - '#markup' => t('Menu selection requires the activation of Menu UI module.'), + '#markup' => $this->t('Menu selection requires the activation of Menu UI module.'), ); } $form['tab_options']['weight'] = array( '#suffix' => '
', - '#title' => t('Tab weight'), + '#title' => $this->t('Tab weight'), '#type' => 'textfield', '#default_value' => $tab_options['weight'], '#size' => 5, - '#description' => t('If the parent menu item is a tab, enter the weight of the tab. Heavier tabs will sink and the lighter tabs will be positioned nearer to the first menu item.'), + '#description' => $this->t('If the parent menu item is a tab, enter the weight of the tab. Heavier tabs will sink and the lighter tabs will be positioned nearer to the first menu item.'), '#states' => array( 'visible' => array( ':input[name="tab_options[type]"]' => array('value' => 'tab'), @@ -387,19 +387,19 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { $path = $this->getOption('path'); $menu_type = $form_state->getValue(array('menu', 'type')); if ($menu_type == 'normal' && strpos($path, '%') !== FALSE) { - $form_state->setError($form['menu']['type'], t('Views cannot create normal menu items for paths with a % in them.')); + $form_state->setError($form['menu']['type'], $this->t('Views cannot create normal menu items for paths with a % in them.')); } if ($menu_type == 'default tab' || $menu_type == 'tab') { $bits = explode('/', $path); $last = array_pop($bits); if ($last == '%') { - $form_state->setError($form['menu']['type'], t('A display whose path ends with a % cannot be a tab.')); + $form_state->setError($form['menu']['type'], $this->t('A display whose path ends with a % cannot be a tab.')); } } if ($menu_type != 'none' && $form_state->isValueEmpty(array('menu', 'title'))) { - $form_state->setError($form['menu']['title'], t('Title is required for this menu type.')); + $form_state->setError($form['menu']['title'], $this->t('Title is required for this menu type.')); } } } @@ -434,13 +434,13 @@ public function validate() { $menu = $this->getOption('menu'); if (!empty($menu['type']) && $menu['type'] != 'none' && empty($menu['title'])) { - $errors[] = t('Display @display is set to use a menu but the menu link text is not set.', array('@display' => $this->display['display_title'])); + $errors[] = $this->t('Display @display is set to use a menu but the menu link text is not set.', array('@display' => $this->display['display_title'])); } if ($menu['type'] == 'default tab') { $tab_options = $this->getOption('tab_options'); if (!empty($tab_options['type']) && $tab_options['type'] != 'none' && empty($tab_options['title'])) { - $errors[] = t('Display @display is set to use a parent menu but the parent menu link text is not set.', array('@display' => $this->display['display_title'])); + $errors[] = $this->t('Display @display is set to use a parent menu but the parent menu link text is not set.', array('@display' => $this->display['display_title'])); } } @@ -452,9 +452,9 @@ public function validate() { */ public function getArgumentText() { return array( - 'filter value not present' => t('When the filter value is NOT in the URL'), - 'filter value present' => t('When the filter value IS in the URL or a default is provided'), - 'description' => t('The contextual filter values is provided by the URL.'), + 'filter value not present' => $this->t('When the filter value is NOT in the URL'), + 'filter value present' => $this->t('When the filter value IS in the URL or a default is provided'), + 'description' => $this->t('The contextual filter values is provided by the URL.'), ); } @@ -463,8 +463,8 @@ public function getArgumentText() { */ public function getPagerText() { return array( - 'items per page title' => t('Items per page'), - 'items per page description' => t('The number of items to display per page. Enter 0 for no limit.') + 'items per page title' => $this->t('Items per page'), + 'items per page description' => $this->t('The number of items to display per page. Enter 0 for no limit.') ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/display/PathPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/PathPluginBase.php @@ -356,7 +356,7 @@ public function optionsSummary(&$categories, &$options) { parent::optionsSummary($categories, $options); $categories['page'] = array( - 'title' => t('Page settings'), + 'title' => $this->t('Page settings'), 'column' => 'second', 'build' => array( '#weight' => -10, @@ -366,7 +366,7 @@ public function optionsSummary(&$categories, &$options) { $path = strip_tags($this->getOption('path')); if (empty($path)) { - $path = t('No path is set'); + $path = $this->t('No path is set'); } else { $path = '/' . $path; @@ -374,7 +374,7 @@ public function optionsSummary(&$categories, &$options) { $options['path'] = array( 'category' => 'page', - 'title' => t('Path'), + 'title' => $this->t('Path'), 'value' => views_ui_truncate($path, 24), ); } @@ -387,11 +387,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'path': - $form['#title'] .= t('The menu path or URL of this view'); + $form['#title'] .= $this->t('The menu path or URL of this view'); $form['path'] = array( '#type' => 'textfield', - '#title' => t('Path'), - '#description' => t('This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for contextual filters: For example, "node/%/feed". If needed you can even specify named route parameters like taxonomy/term/%taxonomy_term'), + '#title' => $this->t('Path'), + '#description' => $this->t('This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for contextual filters: For example, "node/%/feed". If needed you can even specify named route parameters like taxonomy/term/%taxonomy_term'), '#default_value' => $this->getOption('path'), '#field_prefix' => '' . url(NULL, array('absolute' => TRUE)), '#field_suffix' => '‎', only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php +++ b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php @@ -57,21 +57,21 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['submit_button'] = array( '#type' => 'textfield', - '#title' => t('Submit button text'), + '#title' => $this->t('Submit button text'), '#default_value' => $this->options['submit_button'], '#required' => TRUE, ); $form['reset_button'] = array( '#type' => 'checkbox', - '#title' => t('Include reset button (resets all applied exposed filters)'), + '#title' => $this->t('Include reset button (resets all applied exposed filters)'), '#default_value' => $this->options['reset_button'], ); $form['reset_button_label'] = array( '#type' => 'textfield', - '#title' => t('Reset button label'), - '#description' => t('Text to display in the reset button of the exposed form.'), + '#title' => $this->t('Reset button label'), + '#description' => $this->t('Text to display in the reset button of the exposed form.'), '#default_value' => $this->options['reset_button_label'], '#required' => TRUE, '#states' => array( @@ -83,21 +83,21 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['exposed_sorts_label'] = array( '#type' => 'textfield', - '#title' => t('Exposed sorts label'), + '#title' => $this->t('Exposed sorts label'), '#default_value' => $this->options['exposed_sorts_label'], '#required' => TRUE, ); $form['expose_sort_order'] = array( '#type' => 'checkbox', - '#title' => t('Allow people to choose the sort order'), - '#description' => t('If sort order is not exposed, the sort criteria settings for each sort will determine its order.'), + '#title' => $this->t('Allow people to choose the sort order'), + '#description' => $this->t('If sort order is not exposed, the sort criteria settings for each sort will determine its order.'), '#default_value' => $this->options['expose_sort_order'], ); $form['sort_asc_label'] = array( '#type' => 'textfield', - '#title' => t('Label for ascending sort'), + '#title' => $this->t('Label for ascending sort'), '#default_value' => $this->options['sort_asc_label'], '#required' => TRUE, '#states' => array( @@ -109,7 +109,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['sort_desc_label'] = array( '#type' => 'textfield', - '#title' => t('Label for descending sort'), + '#title' => $this->t('Label for descending sort'), '#default_value' => $this->options['sort_desc_label'], '#required' => TRUE, '#states' => array( @@ -244,7 +244,7 @@ public function exposedFormAlter(&$form, FormStateInterface $form_state) { $form['sort_order'] = array( '#type' => 'select', '#options' => $sort_order, - '#title' => t('Order', array(), array('context' => 'Sort order')), + '#title' => $this->t('Order', array(), array('context' => 'Sort order')), '#default_value' => $default_sort_order, ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/exposed_form/InputRequired.php +++ b/core/modules/views/src/Plugin/views/exposed_form/InputRequired.php @@ -36,8 +36,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['text_input_required'] = array( '#type' => 'text_format', - '#title' => t('Text on demand'), - '#description' => t('Text to display instead of results until the user selects and applies an exposed filter.'), + '#title' => $this->t('Text on demand'), + '#description' => $this->t('Text to display instead of results until the user selects and applies an exposed filter.'), '#default_value' => $this->options['text_input_required'], '#format' => isset($this->options['text_input_required_format']) ? $this->options['text_input_required_format'] : filter_default_format(), '#editor' => FALSE, only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/Boolean.php +++ b/core/modules/views/src/Plugin/views/field/Boolean.php @@ -50,10 +50,10 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o parent::init($view, $display, $options); $default_formats = array( - 'yes-no' => array(t('Yes'), t('No')), - 'true-false' => array(t('True'), t('False')), - 'on-off' => array(t('On'), t('Off')), - 'enabled-disabled' => array(t('Enabled'), t('Disabled')), + 'yes-no' => array(t('Yes'), $this->t('No')), + 'true-false' => array(t('True'), $this->t('False')), + 'on-off' => array(t('On'), $this->t('Off')), + 'enabled-disabled' => array(t('Enabled'), $this->t('Disabled')), 'boolean' => array(1, 0), 'unicode-yes-no' => array('✔', '✖'), ); @@ -69,13 +69,13 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['type'] = array( '#type' => 'select', - '#title' => t('Output format'), + '#title' => $this->t('Output format'), '#options' => $options, '#default_value' => $this->options['type'], ); $form['type_custom_true'] = array( '#type' => 'textfield', - '#title' => t('Custom output for TRUE'), + '#title' => $this->t('Custom output for TRUE'), '#default_value' => $this->options['type_custom_true'], '#states' => array( 'visible' => array( @@ -85,7 +85,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['type_custom_false'] = array( '#type' => 'textfield', - '#title' => t('Custom output for FALSE'), + '#title' => $this->t('Custom output for FALSE'), '#default_value' => $this->options['type_custom_false'], '#states' => array( 'visible' => array( @@ -95,8 +95,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['not'] = array( '#type' => 'checkbox', - '#title' => t('Reverse'), - '#description' => t('If checked, true will be displayed as false.'), + '#title' => $this->t('Reverse'), + '#description' => $this->t('If checked, true will be displayed as false.'), '#default_value' => $this->options['not'], ); parent::buildOptionsForm($form, $form_state); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/Counter.php +++ b/core/modules/views/src/Plugin/views/field/Counter.php @@ -36,9 +36,9 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['counter_start'] = array( '#type' => 'textfield', - '#title' => t('Starting value'), + '#title' => $this->t('Starting value'), '#default_value' => $this->options['counter_start'], - '#description' => t('Specify the number the counter should start at.'), + '#description' => $this->t('Specify the number the counter should start at.'), '#size' => 2, ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/Date.php +++ b/core/modules/views/src/Plugin/views/field/Date.php @@ -84,28 +84,28 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $date_formats = array(); foreach ($this->dateFormatStorage->loadMultiple() as $machine_name => $value) { - $date_formats[$machine_name] = t('@name format: @date', array('@name' => $value->label(), '@date' => $this->dateFormatter->format(REQUEST_TIME, $machine_name))); + $date_formats[$machine_name] = $this->t('@name format: @date', array('@name' => $value->label(), '@date' => $this->dateFormatter->format(REQUEST_TIME, $machine_name))); } $form['date_format'] = array( '#type' => 'select', - '#title' => t('Date format'), + '#title' => $this->t('Date format'), '#options' => $date_formats + array( - 'custom' => t('Custom'), - 'raw time ago' => t('Time ago'), - 'time ago' => t('Time ago (with "ago" appended)'), - 'raw time hence' => t('Time hence'), - 'time hence' => t('Time hence (with "hence" appended)'), - 'raw time span' => t('Time span (future dates have "-" prepended)'), - 'inverse time span' => t('Time span (past dates have "-" prepended)'), - 'time span' => t('Time span (with "ago/hence" appended)'), + 'custom' => $this->t('Custom'), + 'raw time ago' => $this->t('Time ago'), + 'time ago' => $this->t('Time ago (with "ago" appended)'), + 'raw time hence' => $this->t('Time hence'), + 'time hence' => $this->t('Time hence (with "hence" appended)'), + 'raw time span' => $this->t('Time span (future dates have "-" prepended)'), + 'inverse time span' => $this->t('Time span (past dates have "-" prepended)'), + 'time span' => $this->t('Time span (with "ago/hence" appended)'), ), '#default_value' => isset($this->options['date_format']) ? $this->options['date_format'] : 'small', ); $form['custom_date_format'] = array( '#type' => 'textfield', - '#title' => t('Custom date format'), - '#description' => t('If "Custom", see the PHP docs for date formats. Otherwise, enter the number of different time units to display, which defaults to 2.'), + '#title' => $this->t('Custom date format'), + '#description' => $this->t('If "Custom", see the PHP docs for date formats. Otherwise, enter the number of different time units to display, which defaults to 2.'), '#default_value' => isset($this->options['custom_date_format']) ? $this->options['custom_date_format'] : '', ); // Setup #states for all possible date_formats on the custom_date_format form element. @@ -116,9 +116,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } $form['timezone'] = array( '#type' => 'select', - '#title' => t('Timezone'), - '#description' => t('Timezone to be used for date output.'), - '#options' => array('' => t('- Default site/user timezone -')) + system_time_zones(FALSE), + '#title' => $this->t('Timezone'), + '#description' => $this->t('Timezone to be used for date output.'), + '#options' => array('' => $this->t('- Default site/user timezone -')) + system_time_zones(FALSE), '#default_value' => $this->options['timezone'], ); foreach (array_merge(array('custom'), array_keys($date_formats)) as $timezone_date_formats) { @@ -147,17 +147,17 @@ public function render(ResultRow $values) { case 'raw time ago': return $this->dateFormatter->formatInterval($time_diff, is_numeric($custom_format) ? $custom_format : 2); case 'time ago': - return t('%time ago', array('%time' => $this->dateFormatter->formatInterval($time_diff, is_numeric($custom_format) ? $custom_format : 2))); + return $this->t('%time ago', array('%time' => $this->dateFormatter->formatInterval($time_diff, is_numeric($custom_format) ? $custom_format : 2))); case 'raw time hence': return $this->dateFormatter->formatInterval(-$time_diff, is_numeric($custom_format) ? $custom_format : 2); case 'time hence': - return t('%time hence', array('%time' => $this->dateFormatter->formatInterval(-$time_diff, is_numeric($custom_format) ? $custom_format : 2))); + return $this->t('%time hence', array('%time' => $this->dateFormatter->formatInterval(-$time_diff, is_numeric($custom_format) ? $custom_format : 2))); case 'raw time span': return ($time_diff < 0 ? '-' : '') . $this->dateFormatter->formatInterval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2); case 'inverse time span': return ($time_diff > 0 ? '-' : '') . $this->dateFormatter->formatInterval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2); case 'time span': - return t(($time_diff < 0 ? '%time hence' : '%time ago'), array('%time' => $this->dateFormatter->formatInterval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2))); + return $this->t(($time_diff < 0 ? '%time hence' : '%time ago'), array('%time' => $this->dateFormatter->formatInterval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2))); case 'custom': if ($custom_format == 'r') { return format_date($value, $format, $custom_format, $timezone, 'en'); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/EntityLabel.php +++ b/core/modules/views/src/Plugin/views/field/EntityLabel.php @@ -88,8 +88,8 @@ protected function defineOptions() { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['link_to_entity'] = array( - '#title' => t('Link to entity'), - '#description' => t('Make entity label a link to entity page.'), + '#title' => $this->t('Link to entity'), + '#description' => $this->t('Make entity label a link to entity page.'), '#type' => 'checkbox', '#default_value' => !empty($this->options['link_to_entity']), ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -294,8 +294,8 @@ public function getElements() { if (!isset($elements)) { // @todo Add possible html5 elements. $elements = array( - '' => t(' - Use default -'), - '0' => t('- None -') + '' => $this->t(' - Use default -'), + '0' => $this->t('- None -') ); $elements += \Drupal::config('views.settings')->get('field_rewrite_elements'); } @@ -522,13 +522,13 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $label = $this->label(); $form['custom_label'] = array( '#type' => 'checkbox', - '#title' => t('Create a label'), + '#title' => $this->t('Create a label'), '#default_value' => $label !== '', '#weight' => -103, ); $form['label'] = array( '#type' => 'textfield', - '#title' => t('Label'), + '#title' => $this->t('Label'), '#default_value' => $label, '#states' => array( 'visible' => array( @@ -539,7 +539,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['element_label_colon'] = array( '#type' => 'checkbox', - '#title' => t('Place a colon after the label'), + '#title' => $this->t('Place a colon after the label'), '#default_value' => $this->options['element_label_colon'], '#states' => array( 'visible' => array( @@ -551,30 +551,30 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['exclude'] = array( '#type' => 'checkbox', - '#title' => t('Exclude from display'), + '#title' => $this->t('Exclude from display'), '#default_value' => $this->options['exclude'], - '#description' => t('Enable to load this field as hidden. Often used to group fields, or to use as token in another field.'), + '#description' => $this->t('Enable to load this field as hidden. Often used to group fields, or to use as token in another field.'), '#weight' => -100, ); $form['style_settings'] = array( '#type' => 'details', - '#title' => t('Style settings'), + '#title' => $this->t('Style settings'), '#weight' => 99, ); $form['element_type_enable'] = array( '#type' => 'checkbox', - '#title' => t('Customize field HTML'), + '#title' => $this->t('Customize field HTML'), '#default_value' => !empty($this->options['element_type']) || (string) $this->options['element_type'] == '0' || !empty($this->options['element_class']) || (string) $this->options['element_class'] == '0', '#fieldset' => 'style_settings', ); $form['element_type'] = array( - '#title' => t('HTML element'), + '#title' => $this->t('HTML element'), '#options' => $this->getElements(), '#type' => 'select', '#default_value' => $this->options['element_type'], - '#description' => t('Choose the HTML element to wrap around this field, e.g. H1, H2, etc.'), + '#description' => $this->t('Choose the HTML element to wrap around this field, e.g. H1, H2, etc.'), '#states' => array( 'visible' => array( ':input[name="options[element_type_enable]"]' => array('checked' => TRUE), @@ -585,7 +585,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['element_class_enable'] = array( '#type' => 'checkbox', - '#title' => t('Create a CSS class'), + '#title' => $this->t('Create a CSS class'), '#states' => array( 'visible' => array( ':input[name="options[element_type_enable]"]' => array('checked' => TRUE), @@ -595,8 +595,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#fieldset' => 'style_settings', ); $form['element_class'] = array( - '#title' => t('CSS class'), - '#description' => t('You may use token substitutions from the rewriting section in this class.'), + '#title' => $this->t('CSS class'), + '#description' => $this->t('You may use token substitutions from the rewriting section in this class.'), '#type' => 'textfield', '#default_value' => $this->options['element_class'], '#states' => array( @@ -610,16 +610,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['element_label_type_enable'] = array( '#type' => 'checkbox', - '#title' => t('Customize label HTML'), + '#title' => $this->t('Customize label HTML'), '#default_value' => !empty($this->options['element_label_type']) || (string) $this->options['element_label_type'] == '0' || !empty($this->options['element_label_class']) || (string) $this->options['element_label_class'] == '0', '#fieldset' => 'style_settings', ); $form['element_label_type'] = array( - '#title' => t('Label HTML element'), + '#title' => $this->t('Label HTML element'), '#options' => $this->getElements(FALSE), '#type' => 'select', '#default_value' => $this->options['element_label_type'], - '#description' => t('Choose the HTML element to wrap around this label, e.g. H1, H2, etc.'), + '#description' => $this->t('Choose the HTML element to wrap around this label, e.g. H1, H2, etc.'), '#states' => array( 'visible' => array( ':input[name="options[element_label_type_enable]"]' => array('checked' => TRUE), @@ -629,7 +629,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['element_label_class_enable'] = array( '#type' => 'checkbox', - '#title' => t('Create a CSS class'), + '#title' => $this->t('Create a CSS class'), '#states' => array( 'visible' => array( ':input[name="options[element_label_type_enable]"]' => array('checked' => TRUE), @@ -639,8 +639,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#fieldset' => 'style_settings', ); $form['element_label_class'] = array( - '#title' => t('CSS class'), - '#description' => t('You may use token substitutions from the rewriting section in this class.'), + '#title' => $this->t('CSS class'), + '#description' => $this->t('You may use token substitutions from the rewriting section in this class.'), '#type' => 'textfield', '#default_value' => $this->options['element_label_class'], '#states' => array( @@ -654,16 +654,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['element_wrapper_type_enable'] = array( '#type' => 'checkbox', - '#title' => t('Customize field and label wrapper HTML'), + '#title' => $this->t('Customize field and label wrapper HTML'), '#default_value' => !empty($this->options['element_wrapper_type']) || (string) $this->options['element_wrapper_type'] == '0' || !empty($this->options['element_wrapper_class']) || (string) $this->options['element_wrapper_class'] == '0', '#fieldset' => 'style_settings', ); $form['element_wrapper_type'] = array( - '#title' => t('Wrapper HTML element'), + '#title' => $this->t('Wrapper HTML element'), '#options' => $this->getElements(FALSE), '#type' => 'select', '#default_value' => $this->options['element_wrapper_type'], - '#description' => t('Choose the HTML element to wrap around this field and label, e.g. H1, H2, etc. This may not be used if the field and label are not rendered together, such as with a table.'), + '#description' => $this->t('Choose the HTML element to wrap around this field and label, e.g. H1, H2, etc. This may not be used if the field and label are not rendered together, such as with a table.'), '#states' => array( 'visible' => array( ':input[name="options[element_wrapper_type_enable]"]' => array('checked' => TRUE), @@ -674,7 +674,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['element_wrapper_class_enable'] = array( '#type' => 'checkbox', - '#title' => t('Create a CSS class'), + '#title' => $this->t('Create a CSS class'), '#states' => array( 'visible' => array( ':input[name="options[element_wrapper_type_enable]"]' => array('checked' => TRUE), @@ -684,8 +684,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#fieldset' => 'style_settings', ); $form['element_wrapper_class'] = array( - '#title' => t('CSS class'), - '#description' => t('You may use token substitutions from the rewriting section in this class.'), + '#title' => $this->t('CSS class'), + '#description' => $this->t('You may use token substitutions from the rewriting section in this class.'), '#type' => 'textfield', '#default_value' => $this->options['element_wrapper_class'], '#states' => array( @@ -699,14 +699,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['element_default_classes'] = array( '#type' => 'checkbox', - '#title' => t('Add default classes'), + '#title' => $this->t('Add default classes'), '#default_value' => $this->options['element_default_classes'], - '#description' => t('Use default Views classes to identify the field, field label and field content.'), + '#description' => $this->t('Use default Views classes to identify the field, field label and field content.'), '#fieldset' => 'style_settings', ); $form['alter'] = array( - '#title' => t('Rewrite results'), + '#title' => $this->t('Rewrite results'), '#type' => 'details', '#weight' => 100, ); @@ -715,15 +715,15 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['alter']['#tree'] = TRUE; $form['alter']['alter_text'] = array( '#type' => 'checkbox', - '#title' => t('Override the output of this field with custom text'), + '#title' => $this->t('Override the output of this field with custom text'), '#default_value' => $this->options['alter']['alter_text'], ); $form['alter']['text'] = array( - '#title' => t('Text'), + '#title' => $this->t('Text'), '#type' => 'textarea', '#default_value' => $this->options['alter']['text'], - '#description' => t('The text to display for this field. You may include HTML. You may enter data from this view as per the "Replacement patterns" below.'), + '#description' => $this->t('The text to display for this field. You may include HTML. You may enter data from this view as per the "Replacement patterns" below.'), '#states' => array( 'visible' => array( ':input[name="options[alter][alter_text]"]' => array('checked' => TRUE), @@ -733,14 +733,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['alter']['make_link'] = array( '#type' => 'checkbox', - '#title' => t('Output this field as a custom link'), + '#title' => $this->t('Output this field as a custom link'), '#default_value' => $this->options['alter']['make_link'], ); $form['alter']['path'] = array( - '#title' => t('Link path'), + '#title' => $this->t('Link path'), '#type' => 'textfield', '#default_value' => $this->options['alter']['path'], - '#description' => t('The Drupal path or absolute URL for this link. You may enter data from this view as per the "Replacement patterns" below.'), + '#description' => $this->t('The Drupal path or absolute URL for this link. You may enter data from this view as per the "Replacement patterns" below.'), '#states' => array( 'visible' => array( ':input[name="options[alter][make_link]"]' => array('checked' => TRUE), @@ -750,7 +750,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['alter']['absolute'] = array( '#type' => 'checkbox', - '#title' => t('Use absolute path'), + '#title' => $this->t('Use absolute path'), '#default_value' => $this->options['alter']['absolute'], '#states' => array( 'visible' => array( @@ -760,7 +760,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['alter']['replace_spaces'] = array( '#type' => 'checkbox', - '#title' => t('Replace spaces with dashes'), + '#title' => $this->t('Replace spaces with dashes'), '#default_value' => $this->options['alter']['replace_spaces'], '#states' => array( 'visible' => array( @@ -770,9 +770,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['alter']['external'] = array( '#type' => 'checkbox', - '#title' => t('External server URL'), + '#title' => $this->t('External server URL'), '#default_value' => $this->options['alter']['external'], - '#description' => t("Links to an external server using a full URL: e.g. 'http://www.example.com' or 'www.example.com'."), + '#description' => $this->t("Links to an external server using a full URL: e.g. 'http://www.example.com' or 'www.example.com'."), '#states' => array( 'visible' => array( ':input[name="options[alter][make_link]"]' => array('checked' => TRUE), @@ -781,27 +781,27 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['alter']['path_case'] = array( '#type' => 'select', - '#title' => t('Transform the case'), - '#description' => t('When printing url paths, how to transform the case of the filter value.'), + '#title' => $this->t('Transform the case'), + '#description' => $this->t('When printing url paths, how to transform the case of the filter value.'), '#states' => array( 'visible' => array( ':input[name="options[alter][make_link]"]' => array('checked' => TRUE), ), ), '#options' => array( - 'none' => t('No transform'), - 'upper' => t('Upper case'), - 'lower' => t('Lower case'), - 'ucfirst' => t('Capitalize first letter'), - 'ucwords' => t('Capitalize each word'), + 'none' => $this->t('No transform'), + 'upper' => $this->t('Upper case'), + 'lower' => $this->t('Lower case'), + 'ucfirst' => $this->t('Capitalize first letter'), + 'ucwords' => $this->t('Capitalize each word'), ), '#default_value' => $this->options['alter']['path_case'], ); $form['alter']['link_class'] = array( - '#title' => t('Link class'), + '#title' => $this->t('Link class'), '#type' => 'textfield', '#default_value' => $this->options['alter']['link_class'], - '#description' => t('The CSS class to apply to the link.'), + '#description' => $this->t('The CSS class to apply to the link.'), '#states' => array( 'visible' => array( ':input[name="options[alter][make_link]"]' => array('checked' => TRUE), @@ -809,10 +809,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['alter']['alt'] = array( - '#title' => t('Title text'), + '#title' => $this->t('Title text'), '#type' => 'textfield', '#default_value' => $this->options['alter']['alt'], - '#description' => t('Text to place as "title" text which most browsers display as a tooltip when hovering over the link.'), + '#description' => $this->t('Text to place as "title" text which most browsers display as a tooltip when hovering over the link.'), '#states' => array( 'visible' => array( ':input[name="options[alter][make_link]"]' => array('checked' => TRUE), @@ -820,10 +820,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['alter']['rel'] = array( - '#title' => t('Rel Text'), + '#title' => $this->t('Rel Text'), '#type' => 'textfield', '#default_value' => $this->options['alter']['rel'], - '#description' => t('Include Rel attribute for use in lightbox2 or other javascript utility.'), + '#description' => $this->t('Include Rel attribute for use in lightbox2 or other javascript utility.'), '#states' => array( 'visible' => array( ':input[name="options[alter][make_link]"]' => array('checked' => TRUE), @@ -831,10 +831,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['alter']['prefix'] = array( - '#title' => t('Prefix text'), + '#title' => $this->t('Prefix text'), '#type' => 'textfield', '#default_value' => $this->options['alter']['prefix'], - '#description' => t('Any text to display before this link. You may include HTML.'), + '#description' => $this->t('Any text to display before this link. You may include HTML.'), '#states' => array( 'visible' => array( ':input[name="options[alter][make_link]"]' => array('checked' => TRUE), @@ -842,10 +842,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['alter']['suffix'] = array( - '#title' => t('Suffix text'), + '#title' => $this->t('Suffix text'), '#type' => 'textfield', '#default_value' => $this->options['alter']['suffix'], - '#description' => t('Any text to display after this link. You may include HTML.'), + '#description' => $this->t('Any text to display after this link. You may include HTML.'), '#states' => array( 'visible' => array( ':input[name="options[alter][make_link]"]' => array('checked' => TRUE), @@ -853,10 +853,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['alter']['target'] = array( - '#title' => t('Target'), + '#title' => $this->t('Target'), '#type' => 'textfield', '#default_value' => $this->options['alter']['target'], - '#description' => t("Target of the link, such as _blank, _parent or an iframe's name. This field is rarely used."), + '#description' => $this->t("Target of the link, such as _blank, _parent or an iframe's name. This field is rarely used."), '#states' => array( 'visible' => array( ':input[name="options[alter][make_link]"]' => array('checked' => TRUE), @@ -877,17 +877,17 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $count = 0; // This lets us prepare the key as we want it printed. foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) { - $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->adminLabel())); - $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->adminLabel())); + $options[t('Arguments')]['%' . ++$count] = $this->t('@argument title', array('@argument' => $handler->adminLabel())); + $options[t('Arguments')]['!' . $count] = $this->t('@argument input', array('@argument' => $handler->adminLabel())); } $this->documentSelfTokens($options[t('Fields')]); // Default text. - $output = '

' . t('You must add some additional fields to this display before using this field. These fields may be marked as Exclude from display if you prefer. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.') . '

'; + $output = '

' . $this->t('You must add some additional fields to this display before using this field. These fields may be marked as Exclude from display if you prefer. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.') . '

'; // We have some options, so make a list. if (!empty($options)) { - $output = '

' . t("The following tokens are available for this field. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields. If you would like to have the characters '[' and ']' use the html entity codes '%5B' or '%5D' or they will get replaced with empty space.") . '

'; + $output = '

' . $this->t("The following tokens are available for this field. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields. If you would like to have the characters '[' and ']' use the html entity codes '%5B' or '%5D' or they will get replaced with empty space.") . '

'; foreach (array_keys($options) as $type) { if (!empty($options[$type])) { $items = array(); @@ -909,7 +909,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // make this work. $form['alter']['help'] = array( '#type' => 'details', - '#title' => t('Replacement patterns'), + '#title' => $this->t('Replacement patterns'), '#value' => SafeMarkup::set($output), '#states' => array( 'visible' => array( @@ -928,12 +928,12 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['alter']['trim'] = array( '#type' => 'checkbox', - '#title' => t('Trim this field to a maximum number of characters'), + '#title' => $this->t('Trim this field to a maximum number of characters'), '#default_value' => $this->options['alter']['trim'], ); $form['alter']['max_length'] = array( - '#title' => t('Maximum number of characters'), + '#title' => $this->t('Maximum number of characters'), '#type' => 'textfield', '#default_value' => $this->options['alter']['max_length'], '#states' => array( @@ -945,8 +945,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['alter']['word_boundary'] = array( '#type' => 'checkbox', - '#title' => t('Trim only on a word boundary'), - '#description' => t('If checked, this field be trimmed only on a word boundary. This is guaranteed to be the maximum characters stated or less. If there are no word boundaries this could trim a field to nothing.'), + '#title' => $this->t('Trim only on a word boundary'), + '#description' => $this->t('If checked, this field be trimmed only on a word boundary. This is guaranteed to be the maximum characters stated or less. If there are no word boundaries this could trim a field to nothing.'), '#default_value' => $this->options['alter']['word_boundary'], '#states' => array( 'visible' => array( @@ -957,7 +957,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['alter']['ellipsis'] = array( '#type' => 'checkbox', - '#title' => t('Add "…" at the end of trimmed text'), + '#title' => $this->t('Add "…" at the end of trimmed text'), '#default_value' => $this->options['alter']['ellipsis'], '#states' => array( 'visible' => array( @@ -968,7 +968,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['alter']['more_link'] = array( '#type' => 'checkbox', - '#title' => t('Add a read-more link if output is trimmed'), + '#title' => $this->t('Add a read-more link if output is trimmed'), '#default_value' => $this->options['alter']['more_link'], '#states' => array( 'visible' => array( @@ -979,9 +979,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['alter']['more_link_text'] = array( '#type' => 'textfield', - '#title' => t('More link label'), + '#title' => $this->t('More link label'), '#default_value' => $this->options['alter']['more_link_text'], - '#description' => t('You may use the "Replacement patterns" above.'), + '#description' => $this->t('You may use the "Replacement patterns" above.'), '#states' => array( 'visible' => array( ':input[name="options[alter][trim]"]' => array('checked' => TRUE), @@ -991,9 +991,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['alter']['more_link_path'] = array( '#type' => 'textfield', - '#title' => t('More link path'), + '#title' => $this->t('More link path'), '#default_value' => $this->options['alter']['more_link_path'], - '#description' => t('This can be an internal Drupal path such as node/add or an external URL such as "http://drupal.org". You may use the "Replacement patterns" above.'), + '#description' => $this->t('This can be an internal Drupal path such as node/add or an external URL such as "http://drupal.org". You may use the "Replacement patterns" above.'), '#states' => array( 'visible' => array( ':input[name="options[alter][trim]"]' => array('checked' => TRUE), @@ -1004,8 +1004,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['alter']['html'] = array( '#type' => 'checkbox', - '#title' => t('Field can contain HTML'), - '#description' => t('An HTML corrector will be run to ensure HTML tags are properly closed after trimming.'), + '#title' => $this->t('Field can contain HTML'), + '#description' => $this->t('An HTML corrector will be run to ensure HTML tags are properly closed after trimming.'), '#default_value' => $this->options['alter']['html'], '#states' => array( 'visible' => array( @@ -1016,14 +1016,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['alter']['strip_tags'] = array( '#type' => 'checkbox', - '#title' => t('Strip HTML tags'), + '#title' => $this->t('Strip HTML tags'), '#default_value' => $this->options['alter']['strip_tags'], ); $form['alter']['preserve_tags'] = array( '#type' => 'textfield', - '#title' => t('Preserve certain tags'), - '#description' => t('List the tags that need to be preserved during the stripping process. example "<p> <br>" which will preserve all p and br elements'), + '#title' => $this->t('Preserve certain tags'), + '#description' => $this->t('List the tags that need to be preserved during the stripping process. example "<p> <br>" which will preserve all p and br elements'), '#default_value' => $this->options['alter']['preserve_tags'], '#states' => array( 'visible' => array( @@ -1034,52 +1034,52 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['alter']['trim_whitespace'] = array( '#type' => 'checkbox', - '#title' => t('Remove whitespace'), + '#title' => $this->t('Remove whitespace'), '#default_value' => $this->options['alter']['trim_whitespace'], ); $form['alter']['nl2br'] = array( '#type' => 'checkbox', - '#title' => t('Convert newlines to HTML <br> tags'), + '#title' => $this->t('Convert newlines to HTML <br> tags'), '#default_value' => $this->options['alter']['nl2br'], ); } $form['empty_field_behavior'] = array( '#type' => 'details', - '#title' => t('No results behavior'), + '#title' => $this->t('No results behavior'), '#weight' => 100, ); $form['empty'] = array( '#type' => 'textarea', - '#title' => t('No results text'), + '#title' => $this->t('No results text'), '#default_value' => $this->options['empty'], - '#description' => t('Provide text to display if this field contains an empty result. You may include HTML. You may enter data from this view as per the "Replacement patterns" in the "Rewrite Results" section below.'), + '#description' => $this->t('Provide text to display if this field contains an empty result. You may include HTML. You may enter data from this view as per the "Replacement patterns" in the "Rewrite Results" section below.'), '#fieldset' => 'empty_field_behavior', ); $form['empty_zero'] = array( '#type' => 'checkbox', - '#title' => t('Count the number 0 as empty'), + '#title' => $this->t('Count the number 0 as empty'), '#default_value' => $this->options['empty_zero'], - '#description' => t('Enable to display the "no results text" if the field contains the number 0.'), + '#description' => $this->t('Enable to display the "no results text" if the field contains the number 0.'), '#fieldset' => 'empty_field_behavior', ); $form['hide_empty'] = array( '#type' => 'checkbox', - '#title' => t('Hide if empty'), + '#title' => $this->t('Hide if empty'), '#default_value' => $this->options['hide_empty'], - '#description' => t('Enable to hide this field if it is empty. Note that the field label or rewritten output may still be displayed. To hide labels, check the style or row style settings for empty fields. To hide rewritten content, check the "Hide rewriting if empty" checkbox.'), + '#description' => $this->t('Enable to hide this field if it is empty. Note that the field label or rewritten output may still be displayed. To hide labels, check the style or row style settings for empty fields. To hide rewritten content, check the "Hide rewriting if empty" checkbox.'), '#fieldset' => 'empty_field_behavior', ); $form['hide_alter_empty'] = array( '#type' => 'checkbox', - '#title' => t('Hide rewriting if empty'), + '#title' => $this->t('Hide rewriting if empty'), '#default_value' => $this->options['hide_alter_empty'], - '#description' => t('Do not display rewritten content if this field is empty.'), + '#description' => $this->t('Do not display rewritten content if this field is empty.'), '#fieldset' => 'empty_field_behavior', ); } @@ -1272,7 +1272,7 @@ public function renderText($alter) { $value = $this->renderTrimText($alter, $value); if ($this->options['alter']['more_link'] && strlen($value) < $length) { $tokens = $this->getRenderTokens($alter); - $more_link_text = $this->options['alter']['more_link_text'] ? $this->options['alter']['more_link_text'] : t('more'); + $more_link_text = $this->options['alter']['more_link_text'] ? $this->options['alter']['more_link_text'] : $this->t('more'); $more_link_text = strtr(Xss::filterAdmin($more_link_text), $tokens); $more_link_path = $this->options['alter']['more_link_path']; $more_link_path = strip_tags(decode_entities(strtr($more_link_path, $tokens))); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/FileSize.php +++ b/core/modules/views/src/Plugin/views/field/FileSize.php @@ -30,11 +30,11 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['file_size_display'] = array( - '#title' => t('File size display'), + '#title' => $this->t('File size display'), '#type' => 'select', '#options' => array( - 'formatted' => t('Formatted (in KB or MB)'), - 'bytes' => t('Raw bytes'), + 'formatted' => $this->t('Formatted (in KB or MB)'), + 'bytes' => $this->t('Raw bytes'), ), ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/LanguageField.php +++ b/core/modules/views/src/Plugin/views/field/LanguageField.php @@ -29,10 +29,10 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['native_language'] = array( - '#title' => t('Native language'), + '#title' => $this->t('Native language'), '#type' => 'checkbox', '#default_value' => $this->options['native_language'], - '#description' => t('If enabled, the native name of the language will be displayed'), + '#description' => $this->t('If enabled, the native name of the language will be displayed'), ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/Links.php +++ b/core/modules/views/src/Plugin/views/field/Links.php @@ -44,15 +44,15 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $field_options = $this->getPreviousFieldLabels(); $form['fields'] = array( '#type' => 'checkboxes', - '#title' => t('Fields'), - '#description' => t('Fields to be included as links.'), + '#title' => $this->t('Fields'), + '#description' => $this->t('Fields to be included as links.'), '#options' => $field_options, '#default_value' => $this->options['fields'], ); $form['destination'] = array( '#type' => 'checkbox', - '#title' => t('Include destination'), - '#description' => t('Include a "destination" parameter in the link to return the user to the original view upon completing the link action.'), + '#title' => $this->t('Include destination'), + '#description' => $this->t('Include a "destination" parameter in the link to return the user to the original view upon completing the link action.'), '#default_value' => $this->options['destination'], ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/MachineName.php +++ b/core/modules/views/src/Plugin/views/field/MachineName.php @@ -57,8 +57,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['machine_name'] = array( - '#title' => t('Output machine name'), - '#description' => t('Display field as machine name.'), + '#title' => $this->t('Output machine name'), + '#description' => $this->t('Display field as machine name.'), '#type' => 'checkbox', '#default_value' => !empty($this->options['machine_name']), ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/Numeric.php +++ b/core/modules/views/src/Plugin/views/field/Numeric.php @@ -43,15 +43,15 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { if (!empty($this->definition['float'])) { $form['set_precision'] = array( '#type' => 'checkbox', - '#title' => t('Round'), - '#description' => t('If checked, the number will be rounded.'), + '#title' => $this->t('Round'), + '#description' => $this->t('If checked, the number will be rounded.'), '#default_value' => $this->options['set_precision'], ); $form['precision'] = array( '#type' => 'textfield', - '#title' => t('Precision'), + '#title' => $this->t('Precision'), '#default_value' => $this->options['precision'], - '#description' => t('Specify how many digits to print after the decimal point.'), + '#description' => $this->t('Specify how many digits to print after the decimal point.'), '#states' => array( 'visible' => array( ':input[name="options[set_precision]"]' => array('checked' => TRUE), @@ -61,37 +61,37 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['decimal'] = array( '#type' => 'textfield', - '#title' => t('Decimal point'), + '#title' => $this->t('Decimal point'), '#default_value' => $this->options['decimal'], - '#description' => t('What single character to use as a decimal point.'), + '#description' => $this->t('What single character to use as a decimal point.'), '#size' => 2, ); } $form['separator'] = array( '#type' => 'select', - '#title' => t('Thousands marker'), + '#title' => $this->t('Thousands marker'), '#options' => array( - '' => t('- None -'), - ',' => t('Comma'), - ' ' => t('Space'), - '.' => t('Decimal'), - '\'' => t('Apostrophe'), + '' => $this->t('- None -'), + ',' => $this->t('Comma'), + ' ' => $this->t('Space'), + '.' => $this->t('Decimal'), + '\'' => $this->t('Apostrophe'), ), '#default_value' => $this->options['separator'], - '#description' => t('What single character to use as the thousands separator.'), + '#description' => $this->t('What single character to use as the thousands separator.'), '#size' => 2, ); $form['format_plural'] = array( '#type' => 'checkbox', - '#title' => t('Format plural'), - '#description' => t('If checked, special handling will be used for plurality.'), + '#title' => $this->t('Format plural'), + '#description' => $this->t('If checked, special handling will be used for plurality.'), '#default_value' => $this->options['format_plural'], ); $form['format_plural_singular'] = array( '#type' => 'textfield', - '#title' => t('Singular form'), + '#title' => $this->t('Singular form'), '#default_value' => $this->options['format_plural_singular'], - '#description' => t('Text to use for the singular form.'), + '#description' => $this->t('Text to use for the singular form.'), '#states' => array( 'visible' => array( ':input[name="options[format_plural]"]' => array('checked' => TRUE), @@ -100,9 +100,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['format_plural_plural'] = array( '#type' => 'textfield', - '#title' => t('Plural form'), + '#title' => $this->t('Plural form'), '#default_value' => $this->options['format_plural_plural'], - '#description' => t('Text to use for the plural form, @count will be replaced with the value.'), + '#description' => $this->t('Text to use for the plural form, @count will be replaced with the value.'), '#states' => array( 'visible' => array( ':input[name="options[format_plural]"]' => array('checked' => TRUE), @@ -111,15 +111,15 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['prefix'] = array( '#type' => 'textfield', - '#title' => t('Prefix'), + '#title' => $this->t('Prefix'), '#default_value' => $this->options['prefix'], - '#description' => t('Text to put before the number, such as currency symbol.'), + '#description' => $this->t('Text to put before the number, such as currency symbol.'), ); $form['suffix'] = array( '#type' => 'textfield', - '#title' => t('Suffix'), + '#title' => $this->t('Suffix'), '#default_value' => $this->options['suffix'], - '#description' => t('Text to put after the number, such as currency symbol.'), + '#description' => $this->t('Text to put after the number, such as currency symbol.'), ); parent::buildOptionsForm($form, $form_state); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/PrerenderList.php +++ b/core/modules/views/src/Plugin/views/field/PrerenderList.php @@ -45,18 +45,18 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['type'] = array( '#type' => 'radios', - '#title' => t('Display type'), + '#title' => $this->t('Display type'), '#options' => array( - 'ul' => t('Unordered list'), - 'ol' => t('Ordered list'), - 'separator' => t('Simple separator'), + 'ul' => $this->t('Unordered list'), + 'ol' => $this->t('Ordered list'), + 'separator' => $this->t('Simple separator'), ), '#default_value' => $this->options['type'], ); $form['separator'] = array( '#type' => 'textfield', - '#title' => t('Separator'), + '#title' => $this->t('Separator'), '#default_value' => $this->options['separator'], '#states' => array( 'visible' => array( only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/Serialized.php +++ b/core/modules/views/src/Plugin/views/field/Serialized.php @@ -33,18 +33,18 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['format'] = array( '#type' => 'select', - '#title' => t('Display format'), - '#description' => t('How should the serialized data be displayed. You can choose a custom array/object key or a print_r on the full output.'), + '#title' => $this->t('Display format'), + '#description' => $this->t('How should the serialized data be displayed. You can choose a custom array/object key or a print_r on the full output.'), '#options' => array( - 'unserialized' => t('Full data (unserialized)'), - 'serialized' => t('Full data (serialized)'), - 'key' => t('A certain key'), + 'unserialized' => $this->t('Full data (unserialized)'), + 'serialized' => $this->t('Full data (serialized)'), + 'key' => $this->t('A certain key'), ), '#default_value' => $this->options['format'], ); $form['key'] = array( '#type' => 'textfield', - '#title' => t('Which key should be displayed'), + '#title' => $this->t('Which key should be displayed'), '#default_value' => $this->options['key'], '#states' => array( 'visible' => array( @@ -57,7 +57,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { public function validateOptionsForm(&$form, FormStateInterface $form_state) { // Require a key if the format is key. if ($form_state->getValue(array('options', 'format')) == 'key' && $form_state->getValue(array('options', 'key')) == '') { - $form_state->setError($form['key'], t('You have to enter a key if you want to display a key of the data.')); + $form_state->setError($form['key'], $this->t('You have to enter a key if you want to display a key of the data.')); } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/TimeInterval.php +++ b/core/modules/views/src/Plugin/views/field/TimeInterval.php @@ -70,8 +70,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['granularity'] = array( '#type' => 'textfield', - '#title' => t('Granularity'), - '#description' => t('How many different units to display in the string.'), + '#title' => $this->t('Granularity'), + '#description' => $this->t('How many different units to display in the string.'), '#default_value' => $this->options['granularity'], ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/field/Url.php +++ b/core/modules/views/src/Plugin/views/field/Url.php @@ -32,7 +32,7 @@ protected function defineOptions() { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['display_as_link'] = array( - '#title' => t('Display as link'), + '#title' => $this->t('Display as link'), '#type' => 'checkbox', '#default_value' => !empty($this->options['display_as_link']), ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php +++ b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php @@ -60,15 +60,15 @@ public function operatorOptions($which = 'title') { protected function operators() { return array( '=' => array( - 'title' => t('Is equal to'), + 'title' => $this->t('Is equal to'), 'method' => 'queryOpBoolean', - 'short' => t('='), + 'short' => $this->t('='), 'values' => 1, ), '!=' => array( - 'title' => t('Is not equal to'), + 'title' => $this->t('Is not equal to'), 'method' => 'queryOpBoolean', - 'short' => t('!='), + 'short' => $this->t('!='), 'values' => 1, ), ); @@ -80,7 +80,7 @@ protected function operators() { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->value_value = t('True'); + $this->value_value = $this->t('True'); if (isset($this->definition['label'])) { $this->value_value = $this->definition['label']; } @@ -108,19 +108,19 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o public function getValueOptions() { if (isset($this->definition['type'])) { if ($this->definition['type'] == 'yes-no') { - $this->value_options = array(1 => t('Yes'), 0 => t('No')); + $this->value_options = array(1 => $this->t('Yes'), 0 => $this->t('No')); } if ($this->definition['type'] == 'on-off') { - $this->value_options = array(1 => t('On'), 0 => t('Off')); + $this->value_options = array(1 => $this->t('On'), 0 => $this->t('Off')); } if ($this->definition['type'] == 'enabled-disabled') { - $this->value_options = array(1 => t('Enabled'), 0 => t('Disabled')); + $this->value_options = array(1 => $this->t('Enabled'), 0 => $this->t('Disabled')); } } // Provide a fallback if the above didn't set anything. if (!isset($this->value_options)) { - $this->value_options = array(1 => t('True'), 0 => t('False')); + $this->value_options = array(1 => $this->t('True'), 0 => $this->t('False')); } } @@ -160,23 +160,23 @@ protected function valueForm(&$form, FormStateInterface $form_state) { } // If we're configuring an exposed filter, add an - Any - option. if (!$exposed || empty($this->options['expose']['required'])) { - $form['value']['#options'] = array('All' => t('- Any -')) + $form['value']['#options']; + $form['value']['#options'] = array('All' => $this->t('- Any -')) + $form['value']['#options']; } } } protected function valueValidate($form, FormStateInterface $form_state) { if ($form_state->getValue(array('options', 'value')) == 'All' && !$form_state->isValueEmpty(array('options', 'expose', 'required'))) { - $form_state->setErrorByName('value', t('You must select a value unless this is an non-required exposed filter.')); + $form_state->setErrorByName('value', $this->t('You must select a value unless this is an non-required exposed filter.')); } } public function adminSummary() { if ($this->isAGroup()) { - return t('grouped'); + return $this->t('grouped'); } if (!empty($this->options['exposed'])) { - return t('exposed'); + return $this->t('exposed'); } if (empty($this->value_options)) { $this->getValueOptions(); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/Bundle.php +++ b/core/modules/views/src/Plugin/views/filter/Bundle.php @@ -50,7 +50,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o public function getValueOptions() { if (!isset($this->value_options)) { $types = entity_get_bundles($this->entityTypeId); - $this->value_title = t('@entity types', array('@entity' => $this->entityType->getLabel())); + $this->value_title = $this->t('@entity types', array('@entity' => $this->entityType->getLabel())); $options = array(); foreach ($types as $type => $info) { only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/Combine.php +++ b/core/modules/views/src/Plugin/views/filter/Combine.php @@ -43,15 +43,15 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { if ($options) { $form['fields'] = array( '#type' => 'select', - '#title' => t('Choose fields to combine for filtering'), - '#description' => t("This filter doesn't work for very special field handlers."), + '#title' => $this->t('Choose fields to combine for filtering'), + '#description' => $this->t("This filter doesn't work for very special field handlers."), '#multiple' => TRUE, '#options' => $options, '#default_value' => $this->options['fields'], ); } else { - $form_state->setErrorByName('', t('You have to add some fields to be able to use this filter.')); + $form_state->setErrorByName('', $this->t('You have to add some fields to be able to use this filter.')); } } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/Date.php +++ b/core/modules/views/src/Plugin/views/filter/Date.php @@ -34,10 +34,10 @@ protected function valueForm(&$form, FormStateInterface $form_state) { if (!$form_state->get('exposed')) { $form['value']['type'] = array( '#type' => 'radios', - '#title' => t('Value type'), + '#title' => $this->t('Value type'), '#options' => array( - 'date' => t('A date in any machine readable format. CCYY-MM-DD HH:MM:SS is preferred.'), - 'offset' => t('An offset from the current time such as "!example1" or "!example2"', array('!example1' => '+1 day', '!example2' => '-2 hours -30 minutes')), + 'date' => $this->t('A date in any machine readable format. CCYY-MM-DD HH:MM:SS is preferred.'), + 'offset' => $this->t('An offset from the current time such as "!example1" or "!example2"', array('!example1' => '+1 day', '!example2' => '-2 hours -30 minutes')), ), '#default_value' => !empty($this->value['type']) ? $this->value['type'] : 'date', ); @@ -87,17 +87,17 @@ public function validateValidTime(&$form, FormStateInterface $form_state, $opera if ($operators[$operator]['values'] == 1) { $convert = strtotime($value['value']); if (!empty($form['value']) && ($convert == -1 || $convert === FALSE)) { - $form_state->setError($form['value'], t('Invalid date format.')); + $form_state->setError($form['value'], $this->t('Invalid date format.')); } } elseif ($operators[$operator]['values'] == 2) { $min = strtotime($value['min']); if ($min == -1 || $min === FALSE) { - $form_state->setError($form['min'], t('Invalid date format.')); + $form_state->setError($form['min'], $this->t('Invalid date format.')); } $max = strtotime($value['max']); if ($max == -1 || $max === FALSE) { - $form_state->setError($form['max'], t('Invalid date format.')); + $form_state->setError($form['max'], $this->t('Invalid date format.')); } } } @@ -115,14 +115,14 @@ protected function buildGroupValidate($form, FormStateInterface $form_state) { // Check if the title is defined but value wasn't defined. if (!empty($group['title'])) { if ((!is_array($group['value']) && empty($group['value'])) || (is_array($group['value']) && count(array_filter($group['value'])) == 1)) { - $form_state->setError($form['group_info']['group_items'][$id]['value'], t('The value is required if title for this item is defined.')); + $form_state->setError($form['group_info']['group_items'][$id]['value'], $this->t('The value is required if title for this item is defined.')); } } // Check if the value is defined but title wasn't defined. if ((!is_array($group['value']) && !empty($group['value'])) || (is_array($group['value']) && count(array_filter($group['value'])) > 1)) { if (empty($group['title'])) { - $form_state->setError($form['group_info']['group_items'][$id]['title'], t('The title is required if value for this item is defined.')); + $form_state->setError($form['group_info']['group_items'][$id]['title'], $this->t('The title is required if value for this item is defined.')); } } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/Equality.php +++ b/core/modules/views/src/Plugin/views/filter/Equality.php @@ -26,8 +26,8 @@ class Equality extends FilterPluginBase { */ public function operatorOptions() { return array( - '=' => t('Is equal to'), - '!=' => t('Is not equal to'), + '=' => $this->t('Is equal to'), + '!=' => $this->t('Is not equal to'), ); } @@ -37,7 +37,7 @@ public function operatorOptions() { protected function valueForm(&$form, FormStateInterface $form_state) { $form['value'] = array( '#type' => 'textfield', - '#title' => t('Value'), + '#title' => $this->t('Value'), '#size' => 30, '#default_value' => $this->value, ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php @@ -291,7 +291,7 @@ protected function operatorForm(&$form, FormStateInterface $form_state) { if (!empty($options)) { $form['operator'] = array( '#type' => count($options) < 10 ? 'radios' : 'select', - '#title' => t('Operator'), + '#title' => $this->t('Operator'), '#default_value' => $this->operator, '#options' => $options, ); @@ -384,18 +384,18 @@ protected function showBuildGroupButton(&$form, FormStateInterface $form_state) '#weight' => -190, ); - $grouped_description = t('Grouped filters allow a choice between predefined operator|value pairs.'); + $grouped_description = $this->t('Grouped filters allow a choice between predefined operator|value pairs.'); $form['group_button']['radios'] = array( '#theme_wrappers' => array('container'), '#attributes' => array('class' => array('js-only')), ); $form['group_button']['radios']['radios'] = array( - '#title' => t('Filter type to expose'), + '#title' => $this->t('Filter type to expose'), '#description' => $grouped_description, '#type' => 'radios', '#options' => array( - t('Single filter'), - t('Grouped filters'), + $this->t('Single filter'), + $this->t('Grouped filters'), ), ); @@ -406,7 +406,7 @@ protected function showBuildGroupButton(&$form, FormStateInterface $form_state) $form['group_button']['button'] = array( '#limit_validation_errors' => array(), '#type' => 'submit', - '#value' => t('Grouped filters'), + '#value' => $this->t('Grouped filters'), '#submit' => array(array($this, 'buildGroupForm')), '#attributes' => array('class' => array('use-ajax-submit')), ); @@ -416,7 +416,7 @@ protected function showBuildGroupButton(&$form, FormStateInterface $form_state) $form['group_button']['button'] = array( '#limit_validation_errors' => array(), '#type' => 'submit', - '#value' => t('Single filter'), + '#value' => $this->t('Single filter'), '#submit' => array(array($this, 'buildGroupForm')), '#attributes' => array('class' => array('use-ajax-submit')), ); @@ -469,19 +469,19 @@ public function showExposeButton(&$form, FormStateInterface $form_state) { '#attributes' => array('class' => array('js-only')), ); $form['expose_button']['checkbox']['checkbox'] = array( - '#title' => t('Expose this filter to visitors, to allow them to change it'), + '#title' => $this->t('Expose this filter to visitors, to allow them to change it'), '#type' => 'checkbox', ); // Then add the button itself. if (empty($this->options['exposed'])) { $form['expose_button']['markup'] = array( - '#markup' => '
' . t('This filter is not exposed. Expose it to allow the users to change it.') . '
', + '#markup' => '
' . $this->t('This filter is not exposed. Expose it to allow the users to change it.') . '
', ); $form['expose_button']['button'] = array( '#limit_validation_errors' => array(), '#type' => 'submit', - '#value' => t('Expose filter'), + '#value' => $this->t('Expose filter'), '#submit' => array(array($this, 'displayExposedForm')), '#attributes' => array('class' => array('use-ajax-submit')), ); @@ -489,12 +489,12 @@ public function showExposeButton(&$form, FormStateInterface $form_state) { } else { $form['expose_button']['markup'] = array( - '#markup' => '
' . t('This filter is exposed. If you hide it, users will not be able to change it.') . '
', + '#markup' => '
' . $this->t('This filter is exposed. If you hide it, users will not be able to change it.') . '
', ); $form['expose_button']['button'] = array( '#limit_validation_errors' => array(), '#type' => 'submit', - '#value' => t('Hide filter'), + '#value' => $this->t('Hide filter'), '#submit' => array(array($this, 'displayExposedForm')), '#attributes' => array('class' => array('use-ajax-submit')), ); @@ -519,7 +519,7 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { if (empty($this->always_required)) { $form['expose']['required'] = array( '#type' => 'checkbox', - '#title' => t('Required'), + '#title' => $this->t('Required'), '#default_value' => $this->options['expose']['required'], ); } @@ -532,14 +532,14 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { $form['expose']['label'] = array( '#type' => 'textfield', '#default_value' => $this->options['expose']['label'], - '#title' => t('Label'), + '#title' => $this->t('Label'), '#size' => 40, ); $form['expose']['description'] = array( '#type' => 'textfield', '#default_value' => $this->options['expose']['description'], - '#title' => t('Description'), + '#title' => $this->t('Description'), '#size' => 60, ); @@ -552,16 +552,16 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { $form['expose']['use_operator'] = array( '#type' => 'checkbox', - '#title' => t('Expose operator'), - '#description' => t('Allow the user to choose the operator.'), + '#title' => $this->t('Expose operator'), + '#description' => $this->t('Allow the user to choose the operator.'), '#default_value' => !empty($this->options['expose']['use_operator']), ); $form['expose']['operator_id'] = array( '#type' => 'textfield', '#default_value' => $this->options['expose']['operator_id'], - '#title' => t('Operator identifier'), + '#title' => $this->t('Operator identifier'), '#size' => 40, - '#description' => t('This will appear in the URL after the ? to identify this operator.'), + '#description' => $this->t('This will appear in the URL after the ? to identify this operator.'), '#states' => array( 'visible' => array( ':input[name="options[expose][use_operator]"]' => array('checked' => TRUE), @@ -579,23 +579,23 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { if (empty($this->alwaysMultiple)) { $form['expose']['multiple'] = array( '#type' => 'checkbox', - '#title' => t('Allow multiple selections'), - '#description' => t('Enable to allow users to select multiple items.'), + '#title' => $this->t('Allow multiple selections'), + '#description' => $this->t('Enable to allow users to select multiple items.'), '#default_value' => $this->options['expose']['multiple'], ); } $form['expose']['remember'] = array( '#type' => 'checkbox', - '#title' => t('Remember the last selection'), - '#description' => t('Enable to remember the last selection made by the user.'), + '#title' => $this->t('Remember the last selection'), + '#description' => $this->t('Enable to remember the last selection made by the user.'), '#default_value' => $this->options['expose']['remember'], ); $role_options = array_map('\Drupal\Component\Utility\String::checkPlain', user_role_names()); $form['expose']['remember_roles'] = array( '#type' => 'checkboxes', - '#title' => t('User roles'), - '#description' => t('Remember exposed selection only for the selected user role(s). If you select no roles, the exposed data will never be stored.'), + '#title' => $this->t('User roles'), + '#description' => $this->t('Remember exposed selection only for the selected user role(s). If you select no roles, the exposed data will never be stored.'), '#default_value' => $this->options['expose']['remember_roles'], '#options' => $role_options, '#states' => array( @@ -608,9 +608,9 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { $form['expose']['identifier'] = array( '#type' => 'textfield', '#default_value' => $this->options['expose']['identifier'], - '#title' => t('Filter identifier'), + '#title' => $this->t('Filter identifier'), '#size' => 40, - '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'), + '#description' => $this->t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'), ); } @@ -620,14 +620,14 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { public function validateExposeForm($form, FormStateInterface $form_state) { $identifier = $form_state->getValue(array('options', 'expose', 'identifier')); if (empty($identifier)) { - $form_state->setError($form['expose']['identifier'], t('The identifier is required if the filter is exposed.')); + $form_state->setError($form['expose']['identifier'], $this->t('The identifier is required if the filter is exposed.')); } elseif ($identifier == 'value') { - $form_state->setError($form['expose']['identifier'], t('This identifier is not allowed.')); + $form_state->setError($form['expose']['identifier'], $this->t('This identifier is not allowed.')); } if (!$this->view->display_handler->isIdentifierUnique($form_state->get('id'), $identifier)) { - $form_state->setError($form['expose']['identifier'], t('This identifier is used by another handler.')); + $form_state->setError($form['expose']['identifier'], $this->t('This identifier is used by another handler.')); } } @@ -638,15 +638,15 @@ protected function buildGroupValidate($form, FormStateInterface $form_state) { if (!$form_state->isValueEmpty(array('options', 'group_info'))) { $identifier = $form_state->getValue(array('options', 'group_info', 'identifier')); if (empty($identifier)) { - $form_state->setError($form['group_info']['identifier'], t('The identifier is required if the filter is exposed.')); + $form_state->setError($form['group_info']['identifier'], $this->t('The identifier is required if the filter is exposed.')); } elseif ($identifier == 'value') { - $form_state->setError($form['group_info']['identifier'], t('This identifier is not allowed.')); + $form_state->setError($form['group_info']['identifier'], $this->t('This identifier is not allowed.')); } if (!$this->view->display_handler->isIdentifierUnique($form_state->get('id'), $identifier)) { - $form_state->setError($form['group_info']['identifier'], t('This identifier is used by another handler.')); + $form_state->setError($form['group_info']['identifier'], $this->t('This identifier is used by another handler.')); } } @@ -660,7 +660,7 @@ protected function buildGroupValidate($form, FormStateInterface $form_state) { if (!empty($group['title']) && $operators[$group['operator']]['values'] > 0) { if ((!is_array($group['value']) && trim($group['value']) == "") || (is_array($group['value']) && count(array_filter($group['value'], 'static::arrayFilterZero')) == 0)) { - $form_state->setError($form['group_info']['group_items'][$id]['value'], t('The value is required if title for this item is defined.')); + $form_state->setError($form['group_info']['group_items'][$id]['value'], $this->t('The value is required if title for this item is defined.')); } } @@ -668,7 +668,7 @@ protected function buildGroupValidate($form, FormStateInterface $form_state) { if ((!is_array($group['value']) && trim($group['value']) != "") || (is_array($group['value']) && count(array_filter($group['value'], 'static::arrayFilterZero')) > 0)) { if (empty($group['title'])) { - $form_state->setError($form['group_info']['group_items'][$id]['title'], t('The title is required if value for this item is defined.')); + $form_state->setError($form['group_info']['group_items'][$id]['title'], $this->t('The title is required if value for this item is defined.')); } } } @@ -750,11 +750,11 @@ protected function buildGroupOptions() { */ public function groupForm(&$form, FormStateInterface $form_state) { if (!empty($this->options['group_info']['optional']) && !$this->multipleExposedInput()) { - $groups = array('All' => t('- Any -')); + $groups = array('All' => $this->t('- Any -')); } foreach ($this->options['group_info']['group_items'] as $id => $group) { if (!empty($group['title'])) { - $groups[$id] = $id != 'All' ? t($group['title']) : $group['title']; + $groups[$id] = $id != 'All' ? $this->t($group['title']) : $group['title']; } } @@ -862,48 +862,48 @@ protected function buildExposedFiltersGroupForm(&$form, FormStateInterface $form $form['group_info']['identifier'] = array( '#type' => 'textfield', '#default_value' => $identifier, - '#title' => t('Filter identifier'), + '#title' => $this->t('Filter identifier'), '#size' => 40, - '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'), + '#description' => $this->t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'), ); $form['group_info']['label'] = array( '#type' => 'textfield', '#default_value' => $this->options['group_info']['label'], - '#title' => t('Label'), + '#title' => $this->t('Label'), '#size' => 40, ); $form['group_info']['description'] = array( '#type' => 'textfield', '#default_value' => $this->options['group_info']['description'], - '#title' => t('Description'), + '#title' => $this->t('Description'), '#size' => 60, ); $form['group_info']['optional'] = array( '#type' => 'checkbox', - '#title' => t('Optional'), - '#description' => t('This exposed filter is optional and will have added options to allow it not to be set.'), + '#title' => $this->t('Optional'), + '#description' => $this->t('This exposed filter is optional and will have added options to allow it not to be set.'), '#default_value' => $this->options['group_info']['optional'], ); $form['group_info']['multiple'] = array( '#type' => 'checkbox', - '#title' => t('Allow multiple selections'), - '#description' => t('Enable to allow users to select multiple items.'), + '#title' => $this->t('Allow multiple selections'), + '#description' => $this->t('Enable to allow users to select multiple items.'), '#default_value' => $this->options['group_info']['multiple'], ); $form['group_info']['widget'] = array( '#type' => 'radios', '#default_value' => $this->options['group_info']['widget'], - '#title' => t('Widget type'), + '#title' => $this->t('Widget type'), '#options' => array( - 'radios' => t('Radios'), - 'select' => t('Select'), + 'radios' => $this->t('Radios'), + 'select' => $this->t('Select'), ), - '#description' => t('Select which kind of widget will be used to render the group of filters'), + '#description' => $this->t('Select which kind of widget will be used to render the group of filters'), ); $form['group_info']['remember'] = array( '#type' => 'checkbox', - '#title' => t('Remember'), - '#description' => t('Remember the last setting the user gave this filter.'), + '#title' => $this->t('Remember'), + '#description' => $this->t('Remember the last setting the user gave this filter.'), '#default_value' => $this->options['group_info']['remember'], ); @@ -916,40 +916,40 @@ protected function buildExposedFiltersGroupForm(&$form, FormStateInterface $form $form['group_info']['identifier'] = array( '#type' => 'textfield', '#default_value' => $identifier, - '#title' => t('Filter identifier'), + '#title' => $this->t('Filter identifier'), '#size' => 40, - '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'), + '#description' => $this->t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'), ); $form['group_info']['label'] = array( '#type' => 'textfield', '#default_value' => $this->options['group_info']['label'], - '#title' => t('Label'), + '#title' => $this->t('Label'), '#size' => 40, ); $form['group_info']['optional'] = array( '#type' => 'checkbox', - '#title' => t('Optional'), - '#description' => t('This exposed filter is optional and will have added options to allow it not to be set.'), + '#title' => $this->t('Optional'), + '#description' => $this->t('This exposed filter is optional and will have added options to allow it not to be set.'), '#default_value' => $this->options['group_info']['optional'], ); $form['group_info']['widget'] = array( '#type' => 'radios', '#default_value' => $this->options['group_info']['widget'], - '#title' => t('Widget type'), + '#title' => $this->t('Widget type'), '#options' => array( - 'radios' => t('Radios'), - 'select' => t('Select'), + 'radios' => $this->t('Radios'), + 'select' => $this->t('Select'), ), - '#description' => t('Select which kind of widget will be used to render the group of filters'), + '#description' => $this->t('Select which kind of widget will be used to render the group of filters'), ); $form['group_info']['remember'] = array( '#type' => 'checkbox', - '#title' => t('Remember'), - '#description' => t('Remember the last setting the user gave this filter.'), + '#title' => $this->t('Remember'), + '#description' => $this->t('Remember the last setting the user gave this filter.'), '#default_value' => $this->options['group_info']['remember'], ); - $groups = array('All' => t('- Any -')); // The string '- Any -' will not be rendered see @theme_views_ui_build_group_filter_form + $groups = array('All' => $this->t('- Any -')); // The string '- Any -' will not be rendered see @theme_views_ui_build_group_filter_form // Provide 3 options to start when we are in a new group. if (count($this->options['group_info']['group_items']) == 0) { @@ -970,7 +970,7 @@ protected function buildExposedFiltersGroupForm(&$form, FormStateInterface $form // In each row, we have to display the operator form and the value from // $row acts as a fake form to render each widget in a row. $row = array(); - $groups[$item_id] = t('Grouping @id', array('@id' => $item_id)); + $groups[$item_id] = $this->t('Grouping @id', array('@id' => $item_id)); $this->operatorForm($row, $form_state); // Force the operator form to be a select box. Some handlers uses // radios and they occupy a lot of space in a table row. @@ -1028,7 +1028,7 @@ protected function buildExposedFiltersGroupForm(&$form, FormStateInterface $form // Per item group, we have a title that identifies it. $form['group_info']['group_items'][$item_id] = array( 'title' => array( - '#title' => t('Label'), + '#title' => $this->t('Label'), '#title_display' => 'invisible', '#type' => 'textfield', '#size' => 20, @@ -1045,7 +1045,7 @@ protected function buildExposedFiltersGroupForm(&$form, FormStateInterface $form '#default_value' => 0, ), 'weight' => array( - '#title' => t('Weight'), + '#title' => $this->t('Weight'), '#title_display' => 'invisible', '#type' => 'weight', '#delta' => 10, @@ -1078,7 +1078,7 @@ protected function buildExposedFiltersGroupForm(&$form, FormStateInterface $form '#prefix' => '
', '#suffix' => '
', '#type' => 'submit', - '#value' => t('Add another item'), + '#value' => $this->t('Add another item'), '#submit' => array(array($this, 'addGroupForm')), '#attributes' => array('class' => array('use-ajax-submit')), ); @@ -1156,7 +1156,7 @@ protected function exposedTranslate(&$form, $type) { } if ($type == 'value' && empty($this->always_required) && empty($this->options['expose']['required']) && $form['#type'] == 'select' && empty($form['#multiple'])) { - $form['#options'] = array('All' => t('- Any -')) + $form['#options']; + $form['#options'] = array('All' => $this->t('- Any -')) + $form['#options']; $form['#default_value'] = 'All'; } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/InOperator.php +++ b/core/modules/views/src/Plugin/views/filter/InOperator.php @@ -40,7 +40,7 @@ class InOperator extends FilterPluginBase { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->value_title = t('Options'); + $this->value_title = $this->t('Options'); $this->value_options = NULL; } @@ -69,7 +69,7 @@ public function getValueOptions() { } } else { - $this->value_options = array(t('Yes'), t('No')); + $this->value_options = array(t('Yes'), $this->t('No')); } return $this->value_options; @@ -84,8 +84,8 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { parent::buildExposeForm($form, $form_state); $form['expose']['reduce'] = array( '#type' => 'checkbox', - '#title' => t('Limit list to selected items'), - '#description' => t('If checked, the only items presented to the user will be the ones selected here.'), + '#title' => $this->t('Limit list to selected items'), + '#description' => $this->t('If checked, the only items presented to the user will be the ones selected here.'), '#default_value' => !empty($this->options['expose']['reduce']), // safety ); } @@ -108,16 +108,16 @@ protected function defineOptions() { function operators() { $operators = array( 'in' => array( - 'title' => t('Is one of'), - 'short' => t('in'), - 'short_single' => t('='), + 'title' => $this->t('Is one of'), + 'short' => $this->t('in'), + 'short_single' => $this->t('='), 'method' => 'opSimple', 'values' => 1, ), 'not in' => array( - 'title' => t('Is not one of'), - 'short' => t('not in'), - 'short_single' => t('<>'), + 'title' => $this->t('Is not one of'), + 'short' => $this->t('not in'), + 'short_single' => $this->t('<>'), 'method' => 'opSimple', 'values' => 1, ), @@ -126,15 +126,15 @@ function operators() { if (!empty($this->definition['allow empty'])) { $operators += array( 'empty' => array( - 'title' => t('Is empty (NULL)'), + 'title' => $this->t('Is empty (NULL)'), 'method' => 'opEmpty', - 'short' => t('empty'), + 'short' => $this->t('empty'), 'values' => 0, ), 'not empty' => array( - 'title' => t('Is not empty (NOT NULL)'), + 'title' => $this->t('Is not empty (NOT NULL)'), 'method' => 'opEmpty', - 'short' => t('not empty'), + 'short' => $this->t('not empty'), 'values' => 0, ), ); @@ -173,7 +173,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { $exposed = $form_state->get('exposed'); if (!$exposed) { // Add a select all option to the value form. - $options = array('all' => t('Select all')); + $options = array('all' => $this->t('Select all')); } $this->getValueOptions(); @@ -314,10 +314,10 @@ protected function valueSubmit($form, FormStateInterface $form_state) { public function adminSummary() { if ($this->isAGroup()) { - return t('grouped'); + return $this->t('grouped'); } if (!empty($this->options['exposed'])) { - return t('exposed'); + return $this->t('exposed'); } $info = $this->operators(); @@ -338,7 +338,7 @@ public function adminSummary() { } // Choose different kind of ouput for 0, a single and multiple values. if (count($this->value) == 0) { - $values = t('Unknown'); + $values = $this->t('Unknown'); } else if (count($this->value) == 1) { // If any, use the 'single' short name of the operator instead. @@ -415,7 +415,7 @@ public function validate() { } if (!in_array($this->operator, $this->operatorValues(1))) { - $errors[] = t('The operator is invalid on filter: @filter.', array('@filter' => $this->adminLabel(TRUE))); + $errors[] = $this->t('The operator is invalid on filter: @filter.', array('@filter' => $this->adminLabel(TRUE))); } if (is_array($this->value)) { if (!isset($this->value_options)) { @@ -438,11 +438,11 @@ public function validate() { } // Choose different kind of ouput for 0, a single and multiple values. if (count($this->value) == 0) { - $errors[] = t('No valid values found on filter: @filter.', array('@filter' => $this->adminLabel(TRUE))); + $errors[] = $this->t('No valid values found on filter: @filter.', array('@filter' => $this->adminLabel(TRUE))); } } elseif (!empty($this->value) && ($this->operator == 'in' || $this->operator == 'not in')) { - $errors[] = t('The value @value is not an array for @operator on filter: @filter', array('@value' => var_export($this->value), '@operator' => $this->operator, '@filter' => $this->adminLabel(TRUE))); + $errors[] = $this->t('The value @value is not an array for @operator on filter: @filter', array('@value' => var_export($this->value), '@operator' => $this->operator, '@filter' => $this->adminLabel(TRUE))); } return $errors; } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/LanguageFilter.php +++ b/core/modules/views/src/Plugin/views/filter/LanguageFilter.php @@ -24,7 +24,7 @@ class LanguageFilter extends InOperator { */ public function getValueOptions() { if (!isset($this->value_options)) { - $this->value_title = t('Language'); + $this->value_title = $this->t('Language'); $this->value_options = $this->listLanguages(LanguageInterface::STATE_ALL |LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED); } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/ManyToOne.php +++ b/core/modules/views/src/Plugin/views/filter/ManyToOne.php @@ -62,25 +62,25 @@ protected function defineOptions() { function operators() { $operators = array( 'or' => array( - 'title' => t('Is one of'), - 'short' => t('or'), - 'short_single' => t('='), + 'title' => $this->t('Is one of'), + 'short' => $this->t('or'), + 'short_single' => $this->t('='), 'method' => 'opHelper', 'values' => 1, 'ensure_my_table' => 'helper', ), 'and' => array( - 'title' => t('Is all of'), - 'short' => t('and'), - 'short_single' => t('='), + 'title' => $this->t('Is all of'), + 'short' => $this->t('and'), + 'short_single' => $this->t('='), 'method' => 'opHelper', 'values' => 1, 'ensure_my_table' => 'helper', ), 'not' => array( - 'title' => t('Is none of'), - 'short' => t('not'), - 'short_single' => t('<>'), + 'title' => $this->t('Is none of'), + 'short' => $this->t('not'), + 'short_single' => $this->t('<>'), 'method' => 'opHelper', 'values' => 1, 'ensure_my_table' => 'helper', @@ -90,15 +90,15 @@ function operators() { if (!empty($this->definition['allow empty'])) { $operators += array( 'empty' => array( - 'title' => t('Is empty (NULL)'), + 'title' => $this->t('Is empty (NULL)'), 'method' => 'opEmpty', - 'short' => t('empty'), + 'short' => $this->t('empty'), 'values' => 0, ), 'not empty' => array( - 'title' => t('Is not empty (NOT NULL)'), + 'title' => $this->t('Is not empty (NOT NULL)'), 'method' => 'opEmpty', - 'short' => t('not empty'), + 'short' => $this->t('not empty'), 'values' => 0, ), ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/Numeric.php +++ b/core/modules/views/src/Plugin/views/filter/Numeric.php @@ -39,56 +39,56 @@ protected function defineOptions() { function operators() { $operators = array( '<' => array( - 'title' => t('Is less than'), + 'title' => $this->t('Is less than'), 'method' => 'opSimple', - 'short' => t('<'), + 'short' => $this->t('<'), 'values' => 1, ), '<=' => array( - 'title' => t('Is less than or equal to'), + 'title' => $this->t('Is less than or equal to'), 'method' => 'opSimple', - 'short' => t('<='), + 'short' => $this->t('<='), 'values' => 1, ), '=' => array( - 'title' => t('Is equal to'), + 'title' => $this->t('Is equal to'), 'method' => 'opSimple', - 'short' => t('='), + 'short' => $this->t('='), 'values' => 1, ), '!=' => array( - 'title' => t('Is not equal to'), + 'title' => $this->t('Is not equal to'), 'method' => 'opSimple', - 'short' => t('!='), + 'short' => $this->t('!='), 'values' => 1, ), '>=' => array( - 'title' => t('Is greater than or equal to'), + 'title' => $this->t('Is greater than or equal to'), 'method' => 'opSimple', - 'short' => t('>='), + 'short' => $this->t('>='), 'values' => 1, ), '>' => array( - 'title' => t('Is greater than'), + 'title' => $this->t('Is greater than'), 'method' => 'opSimple', - 'short' => t('>'), + 'short' => $this->t('>'), 'values' => 1, ), 'between' => array( - 'title' => t('Is between'), + 'title' => $this->t('Is between'), 'method' => 'opBetween', - 'short' => t('between'), + 'short' => $this->t('between'), 'values' => 2, ), 'not between' => array( - 'title' => t('Is not between'), + 'title' => $this->t('Is not between'), 'method' => 'opBetween', - 'short' => t('not between'), + 'short' => $this->t('not between'), 'values' => 2, ), 'regular_expression' => array( - 'title' => t('Regular expression'), - 'short' => t('regex'), + 'title' => $this->t('Regular expression'), + 'short' => $this->t('regex'), 'method' => 'op_regex', 'values' => 1, ), @@ -98,15 +98,15 @@ function operators() { if (!empty($this->definition['allow empty'])) { $operators += array( 'empty' => array( - 'title' => t('Is empty (NULL)'), + 'title' => $this->t('Is empty (NULL)'), 'method' => 'opEmpty', - 'short' => t('empty'), + 'short' => $this->t('empty'), 'values' => 0, ), 'not empty' => array( - 'title' => t('Is not empty (NOT NULL)'), + 'title' => $this->t('Is not empty (NOT NULL)'), 'method' => 'opEmpty', - 'short' => t('not empty'), + 'short' => $this->t('not empty'), 'values' => 0, ), ); @@ -168,7 +168,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { if ($which == 'all') { $form['value']['value'] = array( '#type' => 'textfield', - '#title' => !$exposed ? t('Value') : '', + '#title' => !$exposed ? $this->t('Value') : '', '#size' => 30, '#default_value' => $this->value['value'], ); @@ -188,7 +188,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { // the operator is locked. $form['value'] = array( '#type' => 'textfield', - '#title' => !$exposed ? t('Value') : '', + '#title' => !$exposed ? $this->t('Value') : '', '#size' => 30, '#default_value' => $this->value['value'], ); @@ -201,13 +201,13 @@ protected function valueForm(&$form, FormStateInterface $form_state) { if ($which == 'all' || $which == 'minmax') { $form['value']['min'] = array( '#type' => 'textfield', - '#title' => !$exposed ? t('Min') : '', + '#title' => !$exposed ? $this->t('Min') : '', '#size' => 30, '#default_value' => $this->value['min'], ); $form['value']['max'] = array( '#type' => 'textfield', - '#title' => !$exposed ? t('And max') : t('And'), + '#title' => !$exposed ? $this->t('And max') : $this->t('And'), '#size' => 30, '#default_value' => $this->value['max'], ); @@ -285,16 +285,16 @@ protected function opRegex($field) { public function adminSummary() { if ($this->isAGroup()) { - return t('grouped'); + return $this->t('grouped'); } if (!empty($this->options['exposed'])) { - return t('exposed'); + return $this->t('exposed'); } $options = $this->operatorOptions('short'); $output = UtilityString::checkPlain($options[$this->operator]); if (in_array($this->operator, $this->operatorValues(2))) { - $output .= ' ' . t('@min and @max', array('@min' => $this->value['min'], '@max' => $this->value['max'])); + $output .= ' ' . $this->t('@min and @max', array('@min' => $this->value['min'], '@max' => $this->value['max'])); } elseif (in_array($this->operator, $this->operatorValues(1))) { $output .= ' ' . UtilityString::checkPlain($this->value['value']); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/filter/String.php +++ b/core/modules/views/src/Plugin/views/filter/String.php @@ -40,80 +40,80 @@ protected function defineOptions() { function operators() { $operators = array( '=' => array( - 'title' => t('Is equal to'), - 'short' => t('='), + 'title' => $this->t('Is equal to'), + 'short' => $this->t('='), 'method' => 'opEqual', 'values' => 1, ), '!=' => array( - 'title' => t('Is not equal to'), - 'short' => t('!='), + 'title' => $this->t('Is not equal to'), + 'short' => $this->t('!='), 'method' => 'opEqual', 'values' => 1, ), 'contains' => array( - 'title' => t('Contains'), - 'short' => t('contains'), + 'title' => $this->t('Contains'), + 'short' => $this->t('contains'), 'method' => 'opContains', 'values' => 1, ), 'word' => array( - 'title' => t('Contains any word'), - 'short' => t('has word'), + 'title' => $this->t('Contains any word'), + 'short' => $this->t('has word'), 'method' => 'opContainsWord', 'values' => 1, ), 'allwords' => array( - 'title' => t('Contains all words'), - 'short' => t('has all'), + 'title' => $this->t('Contains all words'), + 'short' => $this->t('has all'), 'method' => 'opContainsWord', 'values' => 1, ), 'starts' => array( - 'title' => t('Starts with'), - 'short' => t('begins'), + 'title' => $this->t('Starts with'), + 'short' => $this->t('begins'), 'method' => 'opStartsWith', 'values' => 1, ), 'not_starts' => array( - 'title' => t('Does not start with'), - 'short' => t('not_begins'), + 'title' => $this->t('Does not start with'), + 'short' => $this->t('not_begins'), 'method' => 'opNotStartsWith', 'values' => 1, ), 'ends' => array( - 'title' => t('Ends with'), - 'short' => t('ends'), + 'title' => $this->t('Ends with'), + 'short' => $this->t('ends'), 'method' => 'opEndsWith', 'values' => 1, ), 'not_ends' => array( - 'title' => t('Does not end with'), - 'short' => t('not_ends'), + 'title' => $this->t('Does not end with'), + 'short' => $this->t('not_ends'), 'method' => 'opNotEndsWith', 'values' => 1, ), 'not' => array( - 'title' => t('Does not contain'), - 'short' => t('!has'), + 'title' => $this->t('Does not contain'), + 'short' => $this->t('!has'), 'method' => 'opNotLike', 'values' => 1, ), 'shorterthan' => array( - 'title' => t('Length is shorter than'), - 'short' => t('shorter than'), + 'title' => $this->t('Length is shorter than'), + 'short' => $this->t('shorter than'), 'method' => 'opShorterThan', 'values' => 1, ), 'longerthan' => array( - 'title' => t('Length is longer than'), - 'short' => t('longer than'), + 'title' => $this->t('Length is longer than'), + 'short' => $this->t('longer than'), 'method' => 'opLongerThan', 'values' => 1, ), 'regular_expression' => array( - 'title' => t('Regular expression'), - 'short' => t('regex'), + 'title' => $this->t('Regular expression'), + 'short' => $this->t('regex'), 'method' => 'opRegex', 'values' => 1, ), @@ -122,15 +122,15 @@ function operators() { if (!empty($this->definition['allow empty'])) { $operators += array( 'empty' => array( - 'title' => t('Is empty (NULL)'), + 'title' => $this->t('Is empty (NULL)'), 'method' => 'opEmpty', - 'short' => t('empty'), + 'short' => $this->t('empty'), 'values' => 0, ), 'not empty' => array( - 'title' => t('Is not empty (NOT NULL)'), + 'title' => $this->t('Is not empty (NOT NULL)'), 'method' => 'opEmpty', - 'short' => t('not empty'), + 'short' => $this->t('not empty'), 'values' => 0, ), ); @@ -153,10 +153,10 @@ public function operatorOptions($which = 'title') { public function adminSummary() { if ($this->isAGroup()) { - return t('grouped'); + return $this->t('grouped'); } if (!empty($this->options['exposed'])) { - return t('exposed'); + return $this->t('exposed'); } $options = $this->operatorOptions('short'); @@ -208,7 +208,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textfield', - '#title' => t('Value'), + '#title' => $this->t('Value'), '#size' => 30, '#default_value' => $this->value, ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/pager/Full.php +++ b/core/modules/views/src/Plugin/views/pager/Full.php @@ -48,21 +48,21 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['quantity'] = array( '#type' => 'number', - '#title' => t('Number of pager links visible'), - '#description' => t('Specify the number of links to pages to display in the pager.'), + '#title' => $this->t('Number of pager links visible'), + '#description' => $this->t('Specify the number of links to pages to display in the pager.'), '#default_value' => $this->options['quantity'], ); $form['tags']['first'] = array( '#type' => 'textfield', - '#title' => t('First page link text'), + '#title' => $this->t('First page link text'), '#default_value' => $this->options['tags']['first'], '#weight' => -10, ); $form['tags']['last'] = array( '#type' => 'textfield', - '#title' => t('Last page link text'), + '#title' => $this->t('Last page link text'), '#default_value' => $this->options['tags']['last'], '#weight' => 10, ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/pager/None.php +++ b/core/modules/views/src/Plugin/views/pager/None.php @@ -37,9 +37,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o public function summaryTitle() { if (!empty($this->options['offset'])) { - return t('All items, skip @skip', array('@skip' => $this->options['offset'])); + return $this->t('All items, skip @skip', array('@skip' => $this->options['offset'])); } - return t('All items'); + return $this->t('All items'); } protected function defineOptions() { @@ -56,8 +56,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['offset'] = array( '#type' => 'textfield', - '#title' => t('Offset (number of items to skip)'), - '#description' => t('For example, set this to 3 and the first 3 items will not be displayed.'), + '#title' => $this->t('Offset (number of items to skip)'), + '#description' => $this->t('For example, set this to 3 and the first 3 items will not be displayed.'), '#default_value' => $this->options['offset'], ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/pager/PagerPluginBase.php +++ b/core/modules/views/src/Plugin/views/pager/PagerPluginBase.php @@ -132,7 +132,7 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) { } * pager plugin. */ public function summaryTitle() { - return t('Unknown'); + return $this->t('Unknown'); } /** only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/pager/Some.php +++ b/core/modules/views/src/Plugin/views/pager/Some.php @@ -53,8 +53,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['offset'] = array( '#type' => 'textfield', - '#title' => t('Offset (number of items to skip)'), - '#description' => t('For example, set this to 3 and the first 3 items will not be displayed.'), + '#title' => $this->t('Offset (number of items to skip)'), + '#description' => $this->t('For example, set this to 3 and the first 3 items will not be displayed.'), '#default_value' => $this->options['offset'], ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/pager/SqlBase.php +++ b/core/modules/views/src/Plugin/views/pager/SqlBase.php @@ -56,22 +56,22 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['offset'] = array( '#type' => 'number', - '#title' => t('Offset (number of items to skip)'), - '#description' => t('For example, set this to 3 and the first 3 items will not be displayed.'), + '#title' => $this->t('Offset (number of items to skip)'), + '#description' => $this->t('For example, set this to 3 and the first 3 items will not be displayed.'), '#default_value' => $this->options['offset'], ); $form['id'] = array( '#type' => 'number', - '#title' => t('Pager ID'), - '#description' => t("Unless you're experiencing problems with pagers related to this view, you should leave this at 0. If using multiple pagers on one page you may need to set this number to a higher value so as not to conflict within the ?page= array. Large values will add a lot of commas to your URLs, so avoid if possible."), + '#title' => $this->t('Pager ID'), + '#description' => $this->t("Unless you're experiencing problems with pagers related to this view, you should leave this at 0. If using multiple pagers on one page you may need to set this number to a higher value so as not to conflict within the ?page= array. Large values will add a lot of commas to your URLs, so avoid if possible."), '#default_value' => $this->options['id'], ); $form['total_pages'] = array( '#type' => 'number', - '#title' => t('Number of pages'), - '#description' => t('The total number of pages. Leave empty to show all pages.'), + '#title' => $this->t('Number of pages'), + '#description' => $this->t('The total number of pages. Leave empty to show all pages.'), '#default_value' => $this->options['total_pages'], ); @@ -79,19 +79,19 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#type' => 'details', '#open' => TRUE, '#tree' => TRUE, - '#title' => t('Pager link labels'), + '#title' => $this->t('Pager link labels'), '#input' => TRUE, ); $form['tags']['previous'] = array( '#type' => 'textfield', - '#title' => t('Previous page link text'), + '#title' => $this->t('Previous page link text'), '#default_value' => $this->options['tags']['previous'], ); $form['tags']['next'] = array( '#type' => 'textfield', - '#title' => t('Next page link text'), + '#title' => $this->t('Next page link text'), '#default_value' => $this->options['tags']['next'], ); @@ -99,23 +99,23 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#type' => 'details', '#open' => TRUE, '#tree' => TRUE, - '#title' => t('Exposed options'), + '#title' => $this->t('Exposed options'), '#input' => TRUE, - '#description' => t('Exposing this options allows users to define their values in a exposed form when view is displayed'), + '#description' => $this->t('Exposing this options allows users to define their values in a exposed form when view is displayed'), ); $form['expose']['items_per_page'] = array( '#type' => 'checkbox', - '#title' => t('Expose items per page'), - '#description' => t('When checked, users can determine how many items per page show in a view'), + '#title' => $this->t('Expose items per page'), + '#description' => $this->t('When checked, users can determine how many items per page show in a view'), '#default_value' => $this->options['expose']['items_per_page'], ); $form['expose']['items_per_page_label'] = array( '#type' => 'textfield', - '#title' => t('Items per page label'), + '#title' => $this->t('Items per page label'), '#required' => TRUE, - '#description' => t('Label to use in the exposed items per page form element.'), + '#description' => $this->t('Label to use in the exposed items per page form element.'), '#default_value' => $this->options['expose']['items_per_page_label'], '#states' => array( 'invisible' => array( @@ -126,9 +126,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['expose']['items_per_page_options'] = array( '#type' => 'textfield', - '#title' => t('Exposed items per page options'), + '#title' => $this->t('Exposed items per page options'), '#required' => TRUE, - '#description' => t('Set between which values the user can choose when determining the items per page. Separated by comma.'), + '#description' => $this->t('Set between which values the user can choose when determining the items per page. Separated by comma.'), '#default_value' => $this->options['expose']['items_per_page_options'], '#states' => array( 'invisible' => array( @@ -140,15 +140,15 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['expose']['items_per_page_options_all'] = array( '#type' => 'checkbox', - '#title' => t('Include all items option'), - '#description' => t('If checked, an extra item will be included to items per page to display all items'), + '#title' => $this->t('Include all items option'), + '#description' => $this->t('If checked, an extra item will be included to items per page to display all items'), '#default_value' => $this->options['expose']['items_per_page_options_all'], ); $form['expose']['items_per_page_options_all_label'] = array( '#type' => 'textfield', - '#title' => t('All items label'), - '#description' => t('Which label will be used to display all items'), + '#title' => $this->t('All items label'), + '#description' => $this->t('Which label will be used to display all items'), '#default_value' => $this->options['expose']['items_per_page_options_all_label'], '#states' => array( 'invisible' => array( @@ -159,16 +159,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['expose']['offset'] = array( '#type' => 'checkbox', - '#title' => t('Expose Offset'), - '#description' => t('When checked, users can determine how many items should be skipped at the beginning.'), + '#title' => $this->t('Expose Offset'), + '#description' => $this->t('When checked, users can determine how many items should be skipped at the beginning.'), '#default_value' => $this->options['expose']['offset'], ); $form['expose']['offset_label'] = array( '#type' => 'textfield', - '#title' => t('Offset label'), + '#title' => $this->t('Offset label'), '#required' => TRUE, - '#description' => t('Label to use in the exposed offset form element.'), + '#description' => $this->t('Label to use in the exposed offset form element.'), '#default_value' => $this->options['expose']['offset_label'], '#states' => array( 'invisible' => array( @@ -197,14 +197,14 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { $error = TRUE; } if ($error) { - $form_state->setErrorByName('pager_options][expose][items_per_page_options', t('Insert a list of integer numeric values separated by commas: e.g: 10, 20, 50, 100')); + $form_state->setErrorByName('pager_options][expose][items_per_page_options', $this->t('Insert a list of integer numeric values separated by commas: e.g: 10, 20, 50, 100')); } // Make sure that the items_per_page is part of the expose settings. if (!$form_state->isValueEmpty(array('pager_options', 'expose', 'items_per_page')) && !$form_state->isValueEmpty(array('pager_options', 'items_per_page'))) { $items_per_page = $form_state->getValue(array('pager_options', 'items_per_page')); if (array_search($items_per_page, $options) === FALSE) { - $form_state->setErrorByName('pager_options][expose][items_per_page_options', t("The Exposed items per page field's options must include the value from the Items per page field (@items_per_page).", + $form_state->setErrorByName('pager_options][expose][items_per_page_options', $this->t("The Exposed items per page field's options must include the value from the Items per page field (@items_per_page).", array('@items_per_page' => $items_per_page)) ); } @@ -371,7 +371,7 @@ public function exposedFormAlter(&$form, FormStateInterface $form_state) { public function exposedFormValidate(&$form, FormStateInterface $form_state) { if (!$form_state->isValueEmpty('offset') && trim($form_state->getValue('offset'))) { if (!is_numeric($form_state->getValue('offset')) || $form_state->getValue('offset') < 0) { - $form_state->setErrorByName('offset', t('Offset must be an number greather or equal than 0.')); + $form_state->setErrorByName('offset', $this->t('Offset must be an number greather or equal than 0.')); } } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/query/QueryPluginBase.php +++ b/core/modules/views/src/Plugin/views/query/QueryPluginBase.php @@ -114,7 +114,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { } public function submitOptionsForm(&$form, FormStateInterface $form_state) { } public function summaryTitle() { - return t('Settings'); + return $this->t('Settings'); } /** only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/query/Sql.php +++ b/core/modules/views/src/Plugin/views/query/Sql.php @@ -206,34 +206,34 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['disable_sql_rewrite'] = array( - '#title' => t('Disable SQL rewriting'), - '#description' => t('Disabling SQL rewriting will disable node_access checks as well as other modules that implement hook_query_alter().'), + '#title' => $this->t('Disable SQL rewriting'), + '#description' => $this->t('Disabling SQL rewriting will disable node_access checks as well as other modules that implement hook_query_alter().'), '#type' => 'checkbox', '#default_value' => !empty($this->options['disable_sql_rewrite']), - '#suffix' => '
' . t('WARNING: Disabling SQL rewriting means that node access security is disabled. This may allow users to see data they should not be able to see if your view is misconfigured. Use this option only if you understand and accept this security risk.') . '
', + '#suffix' => '
' . $this->t('WARNING: Disabling SQL rewriting means that node access security is disabled. This may allow users to see data they should not be able to see if your view is misconfigured. Use this option only if you understand and accept this security risk.') . '
', ); $form['distinct'] = array( '#type' => 'checkbox', - '#title' => t('Distinct'), - '#description' => t('This will make the view display only distinct items. If there are multiple identical items, each will be displayed only once. You can use this to try and remove duplicates from a view, though it does not always work. Note that this can slow queries down, so use it with caution.'), + '#title' => $this->t('Distinct'), + '#description' => $this->t('This will make the view display only distinct items. If there are multiple identical items, each will be displayed only once. You can use this to try and remove duplicates from a view, though it does not always work. Note that this can slow queries down, so use it with caution.'), '#default_value' => !empty($this->options['distinct']), ); $form['replica'] = array( '#type' => 'checkbox', - '#title' => t('Use Secondary Server'), - '#description' => t('This will make the query attempt to connect to a replica server if available. If no replica server is defined or available, it will fall back to the default server.'), + '#title' => $this->t('Use Secondary Server'), + '#description' => $this->t('This will make the query attempt to connect to a replica server if available. If no replica server is defined or available, it will fall back to the default server.'), '#default_value' => !empty($this->options['replica']), ); $form['query_comment'] = array( '#type' => 'textfield', - '#title' => t('Query Comment'), - '#description' => t('If set, this comment will be embedded in the query and passed to the SQL server. This can be helpful for logging or debugging.'), + '#title' => $this->t('Query Comment'), + '#description' => $this->t('If set, this comment will be embedded in the query and passed to the SQL server. This can be helpful for logging or debugging.'), '#default_value' => $this->options['query_comment'], ); $form['query_tags'] = array( '#type' => 'textfield', - '#title' => t('Query Tags'), - '#description' => t('If set, these tags will be appended to the query and can be used to identify the query in a module. This can be helpful for altering queries.'), + '#title' => $this->t('Query Tags'), + '#description' => $this->t('If set, these tags will be appended to the query and can be used to identify the query in a module. This can be helpful for altering queries.'), '#default_value' => implode(', ', $this->options['query_tags']), '#element_validate' => array('views_element_validate_tags'), ); @@ -1529,11 +1529,11 @@ public function getAggregationInfo() { // functions into here. return array( 'group' => array( - 'title' => t('Group results together'), + 'title' => $this->t('Group results together'), 'is aggregate' => FALSE, ), 'count' => array( - 'title' => t('Count'), + 'title' => $this->t('Count'), 'method' => 'aggregationMethodSimple', 'handler' => array( 'argument' => 'groupby_numeric', @@ -1543,7 +1543,7 @@ public function getAggregationInfo() { ), ), 'count_distinct' => array( - 'title' => t('Count DISTINCT'), + 'title' => $this->t('Count DISTINCT'), 'method' => 'aggregationMethodDistinct', 'handler' => array( 'argument' => 'groupby_numeric', @@ -1553,7 +1553,7 @@ public function getAggregationInfo() { ), ), 'sum' => array( - 'title' => t('Sum'), + 'title' => $this->t('Sum'), 'method' => 'aggregationMethodSimple', 'handler' => array( 'argument' => 'groupby_numeric', @@ -1563,7 +1563,7 @@ public function getAggregationInfo() { ), ), 'avg' => array( - 'title' => t('Average'), + 'title' => $this->t('Average'), 'method' => 'aggregationMethodSimple', 'handler' => array( 'argument' => 'groupby_numeric', @@ -1573,7 +1573,7 @@ public function getAggregationInfo() { ), ), 'min' => array( - 'title' => t('Minimum'), + 'title' => $this->t('Minimum'), 'method' => 'aggregationMethodSimple', 'handler' => array( 'argument' => 'groupby_numeric', @@ -1583,7 +1583,7 @@ public function getAggregationInfo() { ), ), 'max' => array( - 'title' => t('Maximum'), + 'title' => $this->t('Maximum'), 'method' => 'aggregationMethodSimple', 'handler' => array( 'argument' => 'groupby_numeric', @@ -1593,7 +1593,7 @@ public function getAggregationInfo() { ), ), 'stddev_pop' => array( - 'title' => t('Standard deviation'), + 'title' => $this->t('Standard deviation'), 'method' => 'aggregationMethodSimple', 'handler' => array( 'argument' => 'groupby_numeric', only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php +++ b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php @@ -96,25 +96,25 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // sort and an order for it. $form['subquery_sort'] = array( '#type' => 'select', - '#title' => t('Representative sort criteria'), + '#title' => $this->t('Representative sort criteria'), // Provide the base field as sane default sort option. '#default_value' => !empty($this->options['subquery_sort']) ? $this->options['subquery_sort'] : $this->definition['base'] . '.' . $base_table_data['table']['base']['field'], '#options' => $sort_options, - '#description' => t("The sort criteria is applied to the data brought in by the relationship to determine how a representative item is obtained for each row. For example, to show the most recent node for each user, pick 'Content: Updated date'."), + '#description' => $this->t("The sort criteria is applied to the data brought in by the relationship to determine how a representative item is obtained for each row. For example, to show the most recent node for each user, pick 'Content: Updated date'."), ); $form['subquery_order'] = array( '#type' => 'radios', - '#title' => t('Representative sort order'), - '#description' => t("The ordering to use for the sort criteria selected above."), - '#options' => array('ASC' => t('Ascending'), 'DESC' => t('Descending')), + '#title' => $this->t('Representative sort order'), + '#description' => $this->t("The ordering to use for the sort criteria selected above."), + '#options' => array('ASC' => $this->t('Ascending'), 'DESC' => $this->t('Descending')), '#default_value' => $this->options['subquery_order'], ); $form['subquery_namespace'] = array( '#type' => 'textfield', - '#title' => t('Subquery namespace'), - '#description' => t('Advanced. Enter a namespace for the subquery used by this relationship.'), + '#title' => $this->t('Subquery namespace'), + '#description' => $this->t('Advanced. Enter a namespace for the subquery used by this relationship.'), '#default_value' => $this->options['subquery_namespace'], ); @@ -141,17 +141,17 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['subquery_view'] = array( '#type' => 'select', - '#title' => t('Representative view'), + '#title' => $this->t('Representative view'), '#default_value' => $this->options['subquery_view'], '#options' => $views, - '#description' => t('Advanced. Use another view to generate the relationship subquery. This allows you to use filtering and more than one sort. If you pick a view here, the sort options above are ignored. Your view must have the ID of its base as its only field, and should have some kind of sorting.'), + '#description' => $this->t('Advanced. Use another view to generate the relationship subquery. This allows you to use filtering and more than one sort. If you pick a view here, the sort options above are ignored. Your view must have the ID of its base as its only field, and should have some kind of sorting.'), ); $form['subquery_regenerate'] = array( '#type' => 'checkbox', - '#title' => t('Generate subquery each time view is run'), + '#title' => $this->t('Generate subquery each time view is run'), '#default_value' => $this->options['subquery_regenerate'], - '#description' => t('Will re-generate the subquery for this relationship every time the view is run, instead of only when these options are saved. Use for testing if you are making changes elsewhere. WARNING: seriously impairs performance.'), + '#description' => $this->t('Will re-generate the subquery for this relationship every time the view is run, instead of only when these options are saved. Use for testing if you are making changes elsewhere. WARNING: seriously impairs performance.'), ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php +++ b/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php @@ -113,8 +113,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['required'] = array( '#type' => 'checkbox', - '#title' => t('Require this relationship'), - '#description' => t('Enable to hide items that do not contain this relationship'), + '#title' => $this->t('Require this relationship'), + '#description' => $this->t('Enable to hide items that do not contain this relationship'), '#default_value' => !empty($this->options['required']), ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/row/EntityRow.php +++ b/core/modules/views/src/Plugin/views/row/EntityRow.php @@ -132,7 +132,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['view_mode'] = array( '#type' => 'select', '#options' => \Drupal::entityManager()->getViewModeOptions($this->entityTypeId), - '#title' => t('View mode'), + '#title' => $this->t('View mode'), '#default_value' => $this->options['view_mode'], ); @@ -140,7 +140,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['rendering_language'] = array( '#type' => 'select', '#options' => $options, - '#title' => t('Rendering language'), + '#title' => $this->t('Rendering language'), '#default_value' => $this->options['rendering_language'], '#access' => $this->languageManager->isMultilingual(), ); @@ -170,7 +170,7 @@ public function summaryTitle() { return String::checkPlain($options[$this->options['view_mode']]); } else { - return t('No view mode selected'); + return $this->t('No view mode selected'); } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/row/Fields.php +++ b/core/modules/views/src/Plugin/views/row/Fields.php @@ -57,17 +57,17 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['default_field_elements'] = array( '#type' => 'checkbox', - '#title' => t('Provide default field wrapper elements'), + '#title' => $this->t('Provide default field wrapper elements'), '#default_value' => $this->options['default_field_elements'], - '#description' => t('If not checked, fields that are not configured to customize their HTML elements will get no wrappers at all for their field, label and field + label wrappers. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'), + '#description' => $this->t('If not checked, fields that are not configured to customize their HTML elements will get no wrappers at all for their field, label and field + label wrappers. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'), ); $form['inline'] = array( '#type' => 'checkboxes', - '#title' => t('Inline fields'), + '#title' => $this->t('Inline fields'), '#options' => $options, '#default_value' => $this->options['inline'], - '#description' => t('Inline fields will be displayed next to each other rather than one after another. Note that some fields will ignore this if they are block elements, particularly body fields and other formatted HTML.'), + '#description' => $this->t('Inline fields will be displayed next to each other rather than one after another. Note that some fields will ignore this if they are block elements, particularly body fields and other formatted HTML.'), '#states' => array( 'visible' => array( ':input[name="row_options[default_field_elements]"]' => array('checked' => TRUE), @@ -76,11 +76,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['separator'] = array( - '#title' => t('Separator'), + '#title' => $this->t('Separator'), '#type' => 'textfield', '#size' => 10, '#default_value' => isset($this->options['separator']) ? $this->options['separator'] : '', - '#description' => t('The separator may be placed between inline fields to keep them from squishing up next to each other. You can use HTML in this field.'), + '#description' => $this->t('The separator may be placed between inline fields to keep them from squishing up next to each other. You can use HTML in this field.'), '#states' => array( 'visible' => array( ':input[name="row_options[default_field_elements]"]' => array('checked' => TRUE), @@ -90,9 +90,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['hide_empty'] = array( '#type' => 'checkbox', - '#title' => t('Hide empty fields'), + '#title' => $this->t('Hide empty fields'), '#default_value' => $this->options['hide_empty'], - '#description' => t('Do not display fields, labels or markup for fields that are empty.'), + '#description' => $this->t('Do not display fields, labels or markup for fields that are empty.'), ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/row/RowPluginBase.php +++ b/core/modules/views/src/Plugin/views/row/RowPluginBase.php @@ -102,7 +102,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { } if (!empty($relationship_options)) { - $relationship_options = array_merge(array('none' => t('Do not use a relationship')), $relationship_options); + $relationship_options = array_merge(array('none' => $this->t('Do not use a relationship')), $relationship_options); $rel = empty($this->options['relationship']) ? 'none' : $this->options['relationship']; if (empty($relationship_options[$rel])) { // Pick the first relationship. @@ -111,7 +111,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['relationship'] = array( '#type' => 'select', - '#title' => t('Relationship'), + '#title' => $this->t('Relationship'), '#options' => $relationship_options, '#default_value' => $rel, ); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/row/RssFields.php +++ b/core/modules/views/src/Plugin/views/row/RssFields.php @@ -44,67 +44,67 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); - $initial_labels = array('' => t('- None -')); + $initial_labels = array('' => $this->t('- None -')); $view_fields_labels = $this->displayHandler->getFieldLabels(); $view_fields_labels = array_merge($initial_labels, $view_fields_labels); $form['title_field'] = array( '#type' => 'select', - '#title' => t('Title field'), - '#description' => t('The field that is going to be used as the RSS item title for each row.'), + '#title' => $this->t('Title field'), + '#description' => $this->t('The field that is going to be used as the RSS item title for each row.'), '#options' => $view_fields_labels, '#default_value' => $this->options['title_field'], '#required' => TRUE, ); $form['link_field'] = array( '#type' => 'select', - '#title' => t('Link field'), - '#description' => t('The field that is going to be used as the RSS item link for each row. This must be a drupal relative path.'), + '#title' => $this->t('Link field'), + '#description' => $this->t('The field that is going to be used as the RSS item link for each row. This must be a drupal relative path.'), '#options' => $view_fields_labels, '#default_value' => $this->options['link_field'], '#required' => TRUE, ); $form['description_field'] = array( '#type' => 'select', - '#title' => t('Description field'), - '#description' => t('The field that is going to be used as the RSS item description for each row.'), + '#title' => $this->t('Description field'), + '#description' => $this->t('The field that is going to be used as the RSS item description for each row.'), '#options' => $view_fields_labels, '#default_value' => $this->options['description_field'], '#required' => TRUE, ); $form['creator_field'] = array( '#type' => 'select', - '#title' => t('Creator field'), - '#description' => t('The field that is going to be used as the RSS item creator for each row.'), + '#title' => $this->t('Creator field'), + '#description' => $this->t('The field that is going to be used as the RSS item creator for each row.'), '#options' => $view_fields_labels, '#default_value' => $this->options['creator_field'], '#required' => TRUE, ); $form['date_field'] = array( '#type' => 'select', - '#title' => t('Publication date field'), - '#description' => t('The field that is going to be used as the RSS item pubDate for each row. It needs to be in RFC 2822 format.'), + '#title' => $this->t('Publication date field'), + '#description' => $this->t('The field that is going to be used as the RSS item pubDate for each row. It needs to be in RFC 2822 format.'), '#options' => $view_fields_labels, '#default_value' => $this->options['date_field'], '#required' => TRUE, ); $form['guid_field_options'] = array( '#type' => 'details', - '#title' => t('GUID settings'), + '#title' => $this->t('GUID settings'), '#open' => TRUE, ); $form['guid_field_options']['guid_field'] = array( '#type' => 'select', - '#title' => t('GUID field'), - '#description' => t('The globally unique identifier of the RSS item.'), + '#title' => $this->t('GUID field'), + '#description' => $this->t('The globally unique identifier of the RSS item.'), '#options' => $view_fields_labels, '#default_value' => $this->options['guid_field_options']['guid_field'], '#required' => TRUE, ); $form['guid_field_options']['guid_field_is_permalink'] = array( '#type' => 'checkbox', - '#title' => t('GUID is permalink'), - '#description' => t('The RSS item GUID is a permalink.'), + '#title' => $this->t('GUID is permalink'), + '#description' => $this->t('The RSS item GUID is a permalink.'), '#default_value' => $this->options['guid_field_options']['guid_field_is_permalink'], ); } @@ -114,13 +114,13 @@ public function validate() { $required_options = array('title_field', 'link_field', 'description_field', 'creator_field', 'date_field'); foreach ($required_options as $required_option) { if (empty($this->options[$required_option])) { - $errors[] = t('Row style plugin requires specifying which views fields to use for RSS item.'); + $errors[] = $this->t('Row style plugin requires specifying which views fields to use for RSS item.'); break; } } // Once more for guid. if (empty($this->options['guid_field_options']['guid_field'])) { - $errors[] = t('Row style plugin requires specifying which views fields to use for RSS item.'); + $errors[] = $this->t('Row style plugin requires specifying which views fields to use for RSS item.'); } return $errors; } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/sort/Date.php +++ b/core/modules/views/src/Plugin/views/sort/Date.php @@ -32,16 +32,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['granularity'] = array( '#type' => 'radios', - '#title' => t('Granularity'), + '#title' => $this->t('Granularity'), '#options' => array( - 'second' => t('Second'), - 'minute' => t('Minute'), - 'hour' => t('Hour'), - 'day' => t('Day'), - 'month' => t('Month'), - 'year' => t('Year'), + 'second' => $this->t('Second'), + 'minute' => $this->t('Minute'), + 'hour' => $this->t('Hour'), + 'day' => $this->t('Day'), + 'month' => $this->t('Month'), + 'year' => $this->t('Year'), ), - '#description' => t('The granularity is the smallest unit to use when determining whether two dates are the same; for example, if the granularity is "Year" then all dates in 1999, regardless of when they fall in 1999, will be considered the same date.'), + '#description' => $this->t('The granularity is the smallest unit to use when determining whether two dates are the same; for example, if the granularity is "Year" then all dates in 1999, regardless of when they fall in 1999, will be considered the same date.'), '#default_value' => $this->options['granularity'], ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php +++ b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php @@ -60,17 +60,17 @@ protected function defineOptions() { */ public function adminSummary() { if (!empty($this->options['exposed'])) { - return t('Exposed'); + return $this->t('Exposed'); } switch ($this->options['order']) { case 'ASC': case 'asc': default: - return t('asc'); + return $this->t('asc'); break; case 'DESC'; case 'desc'; - return t('desc'); + return $this->t('desc'); break; } } @@ -109,19 +109,19 @@ public function showExposeButton(&$form, FormStateInterface $form_state) { '#attributes' => array('class' => array('js-only')), ); $form['expose_button']['checkbox']['checkbox'] = array( - '#title' => t('Expose this sort to visitors, to allow them to change it'), + '#title' => $this->t('Expose this sort to visitors, to allow them to change it'), '#type' => 'checkbox', ); // Then add the button itself. if (empty($this->options['exposed'])) { $form['expose_button']['markup'] = array( - '#markup' => '
' . t('This sort is not exposed. Expose it to allow the users to change it.') . '
', + '#markup' => '
' . $this->t('This sort is not exposed. Expose it to allow the users to change it.') . '
', ); $form['expose_button']['button'] = array( '#limit_validation_errors' => array(), '#type' => 'submit', - '#value' => t('Expose sort'), + '#value' => $this->t('Expose sort'), '#submit' => array(array($this, 'displayExposedForm')), '#attributes' => array('class' => array('use-ajax-submit')), ); @@ -129,12 +129,12 @@ public function showExposeButton(&$form, FormStateInterface $form_state) { } else { $form['expose_button']['markup'] = array( - '#markup' => '
' . t('This sort is exposed. If you hide it, users will not be able to change it.') . '
', + '#markup' => '
' . $this->t('This sort is exposed. If you hide it, users will not be able to change it.') . '
', ); $form['expose_button']['button'] = array( '#limit_validation_errors' => array(), '#type' => 'submit', - '#value' => t('Hide sort'), + '#value' => $this->t('Hide sort'), '#submit' => array(array($this, 'displayExposedForm')), '#attributes' => array('class' => array('use-ajax-submit')), ); @@ -173,7 +173,7 @@ protected function showSortForm(&$form, FormStateInterface $form_state) { $options = $this->sortOptions(); if (!empty($options)) { $form['order'] = array( - '#title' => t('Order'), + '#title' => $this->t('Order'), '#type' => 'radios', '#options' => $options, '#default_value' => $this->options['order'], @@ -191,8 +191,8 @@ public function sortSubmit(&$form, FormStateInterface $form_state) { } */ protected function sortOptions() { return array( - 'ASC' => t('Sort ascending'), - 'DESC' => t('Sort descending'), + 'ASC' => $this->t('Sort ascending'), + 'DESC' => $this->t('Sort descending'), ); } @@ -207,7 +207,7 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { $form['expose']['label'] = array( '#type' => 'textfield', '#default_value' => $this->options['expose']['label'], - '#title' => t('Label'), + '#title' => $this->t('Label'), '#required' => TRUE, '#size' => 40, '#weight' => -1, only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/style/DefaultSummary.php +++ b/core/modules/views/src/Plugin/views/style/DefaultSummary.php @@ -45,9 +45,9 @@ public function query() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['base_path'] = array( '#type' => 'textfield', - '#title' => t('Base path'), + '#title' => $this->t('Base path'), '#default_value' => $this->options['base_path'], - '#description' => t('Define the base path for links in this summary + '#description' => $this->t('Define the base path for links in this summary view, i.e. http://example.com/your_view_path/archive. Do not include beginning and ending forward slash. If this value is empty, views will use the first path found as the base path, @@ -56,17 +56,17 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['count'] = array( '#type' => 'checkbox', '#default_value' => !empty($this->options['count']), - '#title' => t('Display record count with link'), + '#title' => $this->t('Display record count with link'), ); $form['override'] = array( '#type' => 'checkbox', '#default_value' => !empty($this->options['override']), - '#title' => t('Override number of items to display'), + '#title' => $this->t('Override number of items to display'), ); $form['items_per_page'] = array( '#type' => 'textfield', - '#title' => t('Items to display'), + '#title' => $this->t('Items to display'), '#default_value' => $this->options['items_per_page'], '#states' => array( 'visible' => array( only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/style/Grid.php +++ b/core/modules/views/src/Plugin/views/style/Grid.php @@ -53,53 +53,53 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['columns'] = array( '#type' => 'number', - '#title' => t('Number of columns'), + '#title' => $this->t('Number of columns'), '#default_value' => $this->options['columns'], '#required' => TRUE, '#min' => 1, ); $form['automatic_width'] = array( '#type' => 'checkbox', - '#title' => t('Automatic width'), - '#description' => t('The width of each column will be calculated automatically based on the number of columns provided. If additional classes are entered or a theme injects classes based on a grid system, disabling this option may prove beneficial.'), + '#title' => $this->t('Automatic width'), + '#description' => $this->t('The width of each column will be calculated automatically based on the number of columns provided. If additional classes are entered or a theme injects classes based on a grid system, disabling this option may prove beneficial.'), '#default_value' => $this->options['automatic_width'], ); $form['alignment'] = array( '#type' => 'radios', - '#title' => t('Alignment'), - '#options' => array('horizontal' => t('Horizontal'), 'vertical' => t('Vertical')), + '#title' => $this->t('Alignment'), + '#options' => array('horizontal' => $this->t('Horizontal'), 'vertical' => $this->t('Vertical')), '#default_value' => $this->options['alignment'], - '#description' => t('Horizontal alignment will place items starting in the upper left and moving right. Vertical alignment will place items starting in the upper left and moving down.'), + '#description' => $this->t('Horizontal alignment will place items starting in the upper left and moving right. Vertical alignment will place items starting in the upper left and moving down.'), ); $form['col_class_default'] = array( - '#title' => t('Default column classes'), - '#description' => t('Add the default views column classes like views-col, col-1 and clearfix to the output. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'), + '#title' => $this->t('Default column classes'), + '#description' => $this->t('Add the default views column classes like views-col, col-1 and clearfix to the output. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'), '#type' => 'checkbox', '#default_value' => $this->options['col_class_default'], ); $form['col_class_custom'] = array( - '#title' => t('Custom column class'), - '#description' => t('Additional classes to provide on each column. Separated by a space.'), + '#title' => $this->t('Custom column class'), + '#description' => $this->t('Additional classes to provide on each column. Separated by a space.'), '#type' => 'textfield', '#default_value' => $this->options['col_class_custom'], ); if ($this->usesFields()) { - $form['col_class_custom']['#description'] .= ' ' . t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.'); + $form['col_class_custom']['#description'] .= ' ' . $this->t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.'); } $form['row_class_default'] = array( - '#title' => t('Default row classes'), - '#description' => t('Adds the default views row classes like views-row, row-1 and clearfix to the output. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'), + '#title' => $this->t('Default row classes'), + '#description' => $this->t('Adds the default views row classes like views-row, row-1 and clearfix to the output. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'), '#type' => 'checkbox', '#default_value' => $this->options['row_class_default'], ); $form['row_class_custom'] = array( - '#title' => t('Custom row class'), - '#description' => t('Additional classes to provide on each row. Separated by a space.'), + '#title' => $this->t('Custom row class'), + '#description' => $this->t('Additional classes to provide on each row. Separated by a space.'), '#type' => 'textfield', '#default_value' => $this->options['row_class_custom'], ); if ($this->usesFields()) { - $form['row_class_custom']['#description'] .= ' ' . t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.'); + $form['row_class_custom']['#description'] .= ' ' . $this->t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.'); } } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/style/HtmlList.php +++ b/core/modules/views/src/Plugin/views/style/HtmlList.php @@ -58,20 +58,20 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['type'] = array( '#type' => 'radios', - '#title' => t('List type'), - '#options' => array('ul' => t('Unordered list'), 'ol' => t('Ordered list')), + '#title' => $this->t('List type'), + '#options' => array('ul' => $this->t('Unordered list'), 'ol' => $this->t('Ordered list')), '#default_value' => $this->options['type'], ); $form['wrapper_class'] = array( - '#title' => t('Wrapper class'), - '#description' => t('The class to provide on the wrapper, outside the list.'), + '#title' => $this->t('Wrapper class'), + '#description' => $this->t('The class to provide on the wrapper, outside the list.'), '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['wrapper_class'], ); $form['class'] = array( - '#title' => t('List class'), - '#description' => t('The class to provide on the list element itself.'), + '#title' => $this->t('List class'), + '#description' => $this->t('The class to provide on the list element itself.'), '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['class'], only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/style/Mapping.php +++ b/core/modules/views/src/Plugin/views/style/Mapping.php @@ -97,7 +97,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $field_options = array(); $required = !empty($mapping[$key]['#required']); if (!$required && empty($mapping[$key]['#multiple'])) { - $field_options = array('' => t('- None -')); + $field_options = array('' => $this->t('- None -')); } $field_options += $field_labels; @@ -118,7 +118,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { if (!empty($mapping[$key]['#toggle'])) { $form['mapping']["toggle_$key"] = array( '#type' => 'checkbox', - '#title' => t('Use a custom %field_name', array('%field_name' => strtolower($mapping[$key]['#title']))), + '#title' => $this->t('Use a custom %field_name', array('%field_name' => strtolower($mapping[$key]['#title']))), '#default_value' => $this->options['mapping']["toggle_$key"], ); $overrides['#states']['visible'][':input[name="style_options[mapping][' . "toggle_$key" . ']"]'] = array('checked' => TRUE); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/style/Rss.php +++ b/core/modules/views/src/Plugin/views/style/Rss.php @@ -79,9 +79,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['description'] = array( '#type' => 'textfield', - '#title' => t('RSS description'), + '#title' => $this->t('RSS description'), '#default_value' => $this->options['description'], - '#description' => t('This will appear in the RSS feed itself.'), + '#description' => $this->t('This will appear in the RSS feed itself.'), '#maxlength' => 1024, ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/style/StylePluginBase.php +++ b/core/modules/views/src/Plugin/views/style/StylePluginBase.php @@ -268,7 +268,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // to FALSE. // @TODO: Document "usesGrouping" in docs.php when docs.php is written. if ($this->usesFields() && $this->usesGrouping()) { - $options = array('' => t('- None -')); + $options = array('' => $this->t('- None -')); $field_labels = $this->displayHandler->getFieldLabels(TRUE); $options += $field_labels; // If there are no fields, we can't group on them. @@ -292,16 +292,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $grouping += array('field' => '', 'rendered' => TRUE, 'rendered_strip' => FALSE); $form['grouping'][$i]['field'] = array( '#type' => 'select', - '#title' => t('Grouping field Nr.@number', array('@number' => $i + 1)), + '#title' => $this->t('Grouping field Nr.@number', array('@number' => $i + 1)), '#options' => $options, '#default_value' => $grouping['field'], - '#description' => t('You may optionally specify a field by which to group the records. Leave blank to not group.'), + '#description' => $this->t('You may optionally specify a field by which to group the records. Leave blank to not group.'), ); $form['grouping'][$i]['rendered'] = array( '#type' => 'checkbox', - '#title' => t('Use rendered output to group rows'), + '#title' => $this->t('Use rendered output to group rows'), '#default_value' => $grouping['rendered'], - '#description' => t('If enabled the rendered output of the grouping field is used to group the rows.'), + '#description' => $this->t('If enabled the rendered output of the grouping field is used to group the rows.'), '#states' => array( 'invisible' => array( ':input[name="style_options[grouping][' . $i . '][field]"]' => array('value' => ''), @@ -310,7 +310,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); $form['grouping'][$i]['rendered_strip'] = array( '#type' => 'checkbox', - '#title' => t('Remove tags from rendered output'), + '#title' => $this->t('Remove tags from rendered output'), '#default_value' => $grouping['rendered_strip'], '#states' => array( 'invisible' => array( @@ -324,19 +324,19 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { if ($this->usesRowClass()) { $form['row_class'] = array( - '#title' => t('Row class'), - '#description' => t('The class to provide on each row.'), + '#title' => $this->t('Row class'), + '#description' => $this->t('The class to provide on each row.'), '#type' => 'textfield', '#default_value' => $this->options['row_class'], ); if ($this->usesFields()) { - $form['row_class']['#description'] .= ' ' . t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.'); + $form['row_class']['#description'] .= ' ' . $this->t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.'); } $form['default_row_class'] = array( - '#title' => t('Add views row classes'), - '#description' => t('Add the default row classes like views-row-1 to the output. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'), + '#title' => $this->t('Add views row classes'), + '#description' => $this->t('Add the default row classes like views-row-1 to the output. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'), '#type' => 'checkbox', '#default_value' => $this->options['default_row_class'], ); @@ -345,8 +345,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { if (!$this->usesFields() || !empty($this->options['uses_fields'])) { $form['uses_fields'] = array( '#type' => 'checkbox', - '#title' => t('Force using fields'), - '#description' => t('If neither the row nor the style plugin supports fields, this field allows to enable them, so you can for example use groupby.'), + '#title' => $this->t('Force using fields'), + '#description' => $this->t('If neither the row nor the style plugin supports fields, this field allows to enable them, so you can for example use groupby.'), '#default_value' => $this->options['uses_fields'], ); } @@ -701,7 +701,7 @@ public function validate() { if ($this->usesRowPlugin()) { $plugin = $this->displayHandler->getPlugin('row'); if (empty($plugin)) { - $errors[] = t('Style @style requires a row style but the row plugin is invalid.', array('@style' => $this->definition['title'])); + $errors[] = $this->t('Style @style requires a row style but the row plugin is invalid.', array('@style' => $this->definition['title'])); } else { $result = $plugin->validate(); only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/style/Table.php +++ b/core/modules/views/src/Plugin/views/style/Table.php @@ -209,48 +209,48 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $handlers = $this->displayHandler->getHandlers('field'); if (empty($handlers)) { $form['error_markup'] = array( - '#markup' => '
' . t('You need at least one field before you can configure your table settings') . '
', + '#markup' => '
' . $this->t('You need at least one field before you can configure your table settings') . '
', ); return; } $form['override'] = array( '#type' => 'checkbox', - '#title' => t('Override normal sorting if click sorting is used'), + '#title' => $this->t('Override normal sorting if click sorting is used'), '#default_value' => !empty($this->options['override']), ); $form['sticky'] = array( '#type' => 'checkbox', - '#title' => t('Enable Drupal style "sticky" table headers (Javascript)'), + '#title' => $this->t('Enable Drupal style "sticky" table headers (Javascript)'), '#default_value' => !empty($this->options['sticky']), - '#description' => t('(Sticky header effects will not be active for preview below, only on live output.)'), + '#description' => $this->t('(Sticky header effects will not be active for preview below, only on live output.)'), ); $form['caption'] = array( '#type' => 'textfield', - '#title' => t('Caption for the table'), - '#description' => t('A title which is semantically associated to your table for increased accessibility.'), + '#title' => $this->t('Caption for the table'), + '#description' => $this->t('A title which is semantically associated to your table for increased accessibility.'), '#default_value' => $this->options['caption'], '#maxlength' => 255, ); $form['accessibility_details'] = array( '#type' => 'details', - '#title' => t('Table details'), + '#title' => $this->t('Table details'), ); $form['summary'] = array( - '#title' => t('Summary title'), + '#title' => $this->t('Summary title'), '#type' => 'textfield', '#default_value' => $this->options['summary'], '#fieldset' => 'accessibility_details', ); $form['description'] = array( - '#title' => t('Table description'), + '#title' => $this->t('Table description'), '#type' => 'textarea', - '#description' => t('Provide additional details about the table to increase accessibility.'), + '#description' => $this->t('Provide additional details about the table to increase accessibility.'), '#default_value' => $this->options['description'], '#states' => array( 'visible' => array( @@ -283,7 +283,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $column_selector = ':input[name="style_options[columns][' . $field . ']"]'; $form['columns'][$field] = array( - '#title' => t('Columns for @field', array('@field' => $field)), + '#title' => $this->t('Columns for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'select', '#options' => $field_names, @@ -291,7 +291,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); if ($handlers[$field]->clickSortable()) { $form['info'][$field]['sortable'] = array( - '#title' => t('Sortable for @field', array('@field' => $field)), + '#title' => $this->t('Sortable for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'checkbox', '#default_value' => !empty($this->options['info'][$field]['sortable']), @@ -302,10 +302,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['info'][$field]['default_sort_order'] = array( - '#title' => t('Default sort order for @field', array('@field' => $field)), + '#title' => $this->t('Default sort order for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'select', - '#options' => array('asc' => t('Ascending'), 'desc' => t('Descending')), + '#options' => array('asc' => $this->t('Ascending'), 'desc' => $this->t('Descending')), '#default_value' => !empty($this->options['info'][$field]['default_sort_order']) ? $this->options['info'][$field]['default_sort_order'] : 'asc', '#states' => array( 'visible' => array( @@ -317,7 +317,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // Provide an ID so we can have such things. $radio_id = drupal_html_id('edit-default-' . $field); $form['default'][$field] = array( - '#title' => t('Default sort for @field', array('@field' => $field)), + '#title' => $this->t('Default sort for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'radio', '#return_value' => $field, @@ -334,15 +334,15 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ); } $form['info'][$field]['align'] = array( - '#title' => t('Alignment for @field', array('@field' => $field)), + '#title' => $this->t('Alignment for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'select', '#default_value' => !empty($this->options['info'][$field]['align']) ? $this->options['info'][$field]['align'] : '', '#options' => array( - '' => t('None'), - 'views-align-left' => t('Left', array(), array('context' => 'Text alignment')), - 'views-align-center' => t('Center', array(), array('context' => 'Text alignment')), - 'views-align-right' => t('Right', array(), array('context' => 'Text alignment')), + '' => $this->t('None'), + 'views-align-left' => $this->t('Left', array(), array('context' => 'Text alignment')), + 'views-align-center' => $this->t('Center', array(), array('context' => 'Text alignment')), + 'views-align-right' => $this->t('Right', array(), array('context' => 'Text alignment')), ), '#states' => array( 'visible' => array( @@ -351,7 +351,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['info'][$field]['separator'] = array( - '#title' => t('Separator for @field', array('@field' => $field)), + '#title' => $this->t('Separator for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'textfield', '#size' => 10, @@ -363,7 +363,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['info'][$field]['empty_column'] = array( - '#title' => t('Hide empty column for @field', array('@field' => $field)), + '#title' => $this->t('Hide empty column for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'checkbox', '#default_value' => isset($this->options['info'][$field]['empty_column']) ? $this->options['info'][$field]['empty_column'] : FALSE, @@ -374,11 +374,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ), ); $form['info'][$field]['responsive'] = array( - '#title' => t('Responsive setting for @field', array('@field' => $field)), + '#title' => $this->t('Responsive setting for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'select', '#default_value' => isset($this->options['info'][$field]['responsive']) ? $this->options['info'][$field]['responsive'] : '', - '#options' => array('' => t('High'), RESPONSIVE_PRIORITY_MEDIUM => t('Medium'), RESPONSIVE_PRIORITY_LOW => t('Low')), + '#options' => array('' => $this->t('High'), RESPONSIVE_PRIORITY_MEDIUM => $this->t('Medium'), RESPONSIVE_PRIORITY_LOW => $this->t('Low')), '#states' => array( 'visible' => array( $column_selector => array('value' => $field), @@ -394,7 +394,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // Provide a radio for no default sort $form['default'][-1] = array( - '#title' => t('No default sort'), + '#title' => $this->t('No default sort'), '#title_display' => 'invisible', '#type' => 'radio', '#return_value' => -1, @@ -405,13 +405,13 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['empty_table'] = array( '#type' => 'checkbox', - '#title' => t('Show the empty text in the table'), + '#title' => $this->t('Show the empty text in the table'), '#default_value' => $this->options['empty_table'], - '#description' => t('Per default the table is hidden for an empty view. With this option it is posible to show an empty table with the text in it.'), + '#description' => $this->t('Per default the table is hidden for an empty view. With this option it is posible to show an empty table with the text in it.'), ); $form['description_markup'] = array( - '#markup' => '
' . t('Place fields into columns; you may combine multiple fields into the same column. If you do, the separator in the column specified will be used to separate the fields. Check the sortable box to make that column click sortable, and check the default sort radio to determine which column will be sorted by default, if any. You may control column order and field labels in the fields section.') . '
', + '#markup' => '
' . $this->t('Place fields into columns; you may combine multiple fields into the same column. If you do, the separator in the column specified will be used to separate the fields. Check the sortable box to make that column click sortable, and check the default sort radio to determine which column will be sorted by default, if any. You may control column order and field labels in the fields section.') . '
', ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/style/UnformattedSummary.php +++ b/core/modules/views/src/Plugin/views/style/UnformattedSummary.php @@ -36,11 +36,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['inline'] = array( '#type' => 'checkbox', '#default_value' => !empty($this->options['inline']), - '#title' => t('Display items inline'), + '#title' => $this->t('Display items inline'), ); $form['separator'] = array( '#type' => 'textfield', - '#title' => t('Separator'), + '#title' => $this->t('Separator'), '#default_value' => $this->options['separator'], ); } only in patch2: unchanged: --- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php @@ -226,12 +226,12 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['displays']['page'] = array( '#type' => 'fieldset', - '#title' => t('Page settings'), + '#title' => $this->t('Page settings'), '#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend')), '#tree' => TRUE, ); $form['displays']['page']['create'] = array( - '#title' => t('Create a page'), + '#title' => $this->t('Create a page'), '#type' => 'checkbox', '#attributes' => array('class' => array('strong')), '#default_value' => FALSE, @@ -254,12 +254,12 @@ public function buildForm(array $form, FormStateInterface $form_state) { ); $form['displays']['page']['options']['title'] = array( - '#title' => t('Page title'), + '#title' => $this->t('Page title'), '#type' => 'textfield', '#maxlength' => 255, ); $form['displays']['page']['options']['path'] = array( - '#title' => t('Path'), + '#title' => $this->t('Path'), '#type' => 'textfield', '#field_prefix' => $path_prefix, // Account for the leading backslash. @@ -267,13 +267,13 @@ public function buildForm(array $form, FormStateInterface $form_state) { ); $form['displays']['page']['options']['style'] = array( '#type' => 'fieldset', - '#title' => t('Page display settings'), + '#title' => $this->t('Page display settings'), '#attributes' => array('class' => array('container-inline', 'fieldset-no-legend')), ); // Create the dropdown for choosing the display format. $form['displays']['page']['options']['style']['style_plugin'] = array( - '#title' => t('Display format'), + '#title' => $this->t('Display format'), '#type' => 'select', '#options' => $style_options, ); @@ -285,18 +285,18 @@ public function buildForm(array $form, FormStateInterface $form_state) { $this->buildFormStyle($form, $form_state, 'page'); $form['displays']['page']['options']['items_per_page'] = array( - '#title' => t('Items to display'), + '#title' => $this->t('Items to display'), '#type' => 'number', '#default_value' => 10, '#min' => 0, ); $form['displays']['page']['options']['pager'] = array( - '#title' => t('Use a pager'), + '#title' => $this->t('Use a pager'), '#type' => 'checkbox', '#default_value' => TRUE, ); $form['displays']['page']['options']['link'] = array( - '#title' => t('Create a menu link'), + '#title' => $this->t('Create a menu link'), '#type' => 'checkbox', '#id' => 'edit-page-link', ); @@ -317,22 +317,22 @@ public function buildForm(array $form, FormStateInterface $form_state) { // These are not yet translated. $menu_options = menu_list_system_menus(); foreach ($menu_options as $name => $title) { - $menu_options[$name] = t($title); + $menu_options[$name] = $this->t($title); } } $form['displays']['page']['options']['link_properties']['menu_name'] = array( - '#title' => t('Menu'), + '#title' => $this->t('Menu'), '#type' => 'select', '#options' => $menu_options, ); $form['displays']['page']['options']['link_properties']['title'] = array( - '#title' => t('Link text'), + '#title' => $this->t('Link text'), '#type' => 'textfield', ); // Only offer a feed if we have at least one available feed row style. if ($feed_row_options) { $form['displays']['page']['options']['feed'] = array( - '#title' => t('Include an RSS feed'), + '#title' => $this->t('Include an RSS feed'), '#type' => 'checkbox', '#id' => 'edit-page-feed', ); @@ -347,7 +347,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#suffix' => '
', ); $form['displays']['page']['options']['feed_properties']['path'] = array( - '#title' => t('Feed path'), + '#title' => $this->t('Feed path'), '#type' => 'textfield', '#field_prefix' => $path_prefix, // Account for the leading backslash. @@ -355,7 +355,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ); // This will almost never be visible. $form['displays']['page']['options']['feed_properties']['row_plugin'] = array( - '#title' => t('Feed row style'), + '#title' => $this->t('Feed row style'), '#type' => 'select', '#options' => $feed_row_options, '#default_value' => key($feed_row_options), @@ -374,12 +374,12 @@ public function buildForm(array $form, FormStateInterface $form_state) { if (\Drupal::moduleHandler()->moduleExists('block')) { $form['displays']['block'] = array( '#type' => 'fieldset', - '#title' => t('Block settings'), + '#title' => $this->t('Block settings'), '#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend')), '#tree' => TRUE, ); $form['displays']['block']['create'] = array( - '#title' => t('Create a block'), + '#title' => $this->t('Create a block'), '#type' => 'checkbox', '#attributes' => array('class' => array('strong')), '#id' => 'edit-block-create', @@ -402,19 +402,19 @@ public function buildForm(array $form, FormStateInterface $form_state) { ); $form['displays']['block']['options']['title'] = array( - '#title' => t('Block title'), + '#title' => $this->t('Block title'), '#type' => 'textfield', '#maxlength' => 255, ); $form['displays']['block']['options']['style'] = array( '#type' => 'fieldset', - '#title' => t('Block display settings'), + '#title' => $this->t('Block display settings'), '#attributes' => array('class' => array('container-inline', 'fieldset-no-legend')), ); // Create the dropdown for choosing the display format. $form['displays']['block']['options']['style']['style_plugin'] = array( - '#title' => t('Display format'), + '#title' => $this->t('Display format'), '#type' => 'select', '#options' => $style_options, ); @@ -426,13 +426,13 @@ public function buildForm(array $form, FormStateInterface $form_state) { $this->buildFormStyle($form, $form_state, 'block'); $form['displays']['block']['options']['items_per_page'] = array( - '#title' => t('Items per block'), + '#title' => $this->t('Items per block'), '#type' => 'number', '#default_value' => 5, '#min' => 0, ); $form['displays']['block']['options']['pager'] = array( - '#title' => t('Use a pager'), + '#title' => $this->t('Use a pager'), '#type' => 'checkbox', '#default_value' => FALSE, ); @@ -442,12 +442,12 @@ public function buildForm(array $form, FormStateInterface $form_state) { if (\Drupal::moduleHandler()->moduleExists('rest')) { $form['displays']['rest_export'] = array( '#type' => 'fieldset', - '#title' => t('REST export settings'), + '#title' => $this->t('REST export settings'), '#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend')), '#tree' => TRUE, ); $form['displays']['rest_export']['create'] = array( - '#title' => t('Provide a REST export'), + '#title' => $this->t('Provide a REST export'), '#type' => 'checkbox', '#attributes' => array('class' => array('strong')), '#id' => 'edit-rest-export-create', @@ -470,7 +470,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ); $form['displays']['rest_export']['options']['path'] = array( - '#title' => t('REST export path'), + '#title' => $this->t('REST export path'), '#type' => 'textfield', '#field_prefix' => $path_prefix, // Account for the leading backslash. @@ -579,7 +579,7 @@ protected function buildFormStyle(array &$form, FormStateInterface $form_state, $options = $this->rowStyleOptions(); $style_form['row_plugin'] = array( '#type' => 'select', - '#title' => t('of'), + '#title' => $this->t('of'), '#options' => $options, '#access' => count($options) > 1, ); @@ -598,7 +598,7 @@ protected function buildFormStyle(array &$form, FormStateInterface $form_state, ); } elseif ($style_plugin->usesFields()) { - $style_form['row_plugin'] = array('#markup' => '' . t('of fields') . ''); + $style_form['row_plugin'] = array('#markup' => '' . $this->t('of fields') . ''); } } @@ -627,13 +627,13 @@ protected function buildFilters(&$form, FormStateInterface $form_state) { // If the current base table support bundles and has more than one (like user). if (!empty($bundles) && $this->entityType && $this->entityType->hasKey('bundle')) { // Get all bundles and their human readable names. - $options = array('all' => t('All')); + $options = array('all' => $this->t('All')); foreach ($bundles as $type => $bundle) { $options[$type] = $bundle['label']; } $form['displays']['show']['type'] = array( '#type' => 'select', - '#title' => t('of type'), + '#title' => $this->t('of type'), '#options' => $options, ); $selected_bundle = static::getSelected($form_state, array('show', 'type'), 'all', $form['displays']['show']['type']); @@ -652,14 +652,14 @@ protected function buildFilters(&$form, FormStateInterface $form_state) { */ protected function buildSorts(&$form, FormStateInterface $form_state) { $sorts = array( - 'none' => t('Unsorted'), + 'none' => $this->t('Unsorted'), ); // Check if we are allowed to sort by creation date. $created_column = $this->getCreatedColumn(); if ($created_column) { $sorts += array( - $created_column . ':DESC' => t('Newest first'), - $created_column . ':ASC' => t('Oldest first'), + $created_column . ':DESC' => $this->t('Newest first'), + $created_column . ':ASC' => $this->t('Oldest first'), ); } if ($available_sorts = $this->getAvailableSorts()) { @@ -670,7 +670,7 @@ protected function buildSorts(&$form, FormStateInterface $form_state) { if (!empty($sorts)) { $form['displays']['show']['sort'] = array( '#type' => 'select', - '#title' => t('sorted by'), + '#title' => $this->t('sorted by'), '#options' => $sorts, '#default_value' => isset($created_column) ? $created_column . ':DESC' : 'none', ); only in patch2: unchanged: --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php @@ -56,18 +56,18 @@ public function optionsSummary(&$categories, &$options) { parent::optionsSummary($categories, $options); $categories['display_test'] = array( - 'title' => t('Display test settings'), + 'title' => $this->t('Display test settings'), 'column' => 'second', 'build' => array( '#weight' => -100, ), ); - $test_option = $this->getOption('test_option') ?: t('Empty'); + $test_option = $this->getOption('test_option') ?: $this->t('Empty'); $options['test_option'] = array( 'category' => 'display_test', - 'title' => t('Test option'), + 'title' => $this->t('Test option'), 'value' => views_ui_truncate($test_option, 24), ); } @@ -80,11 +80,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'test_option': - $form['#title'] .= t('Test option'); + $form['#title'] .= $this->t('Test option'); $form['test_option'] = array( - '#title' => t('Test option'), + '#title' => $this->t('Test option'), '#type' => 'textfield', - '#description' => t('This is a textfield for test_option.'), + '#description' => $this->t('This is a textfield for test_option.'), '#default_value' => $this->getOption('test_option'), ); break; @@ -100,7 +100,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'test_option': if (!trim($form_state->getValue('test_option'))) { - $form_state->setError($form['test_option'], t('You cannot have an empty option.')); + $form_state->setError($form['test_option'], $this->t('You cannot have an empty option.')); } break; } only in patch2: unchanged: --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php @@ -43,18 +43,18 @@ public function optionsSummary(&$categories, &$options) { parent::optionsSummary($categories, $options); $categories['display_extender_test'] = array( - 'title' => t('Display extender test settings'), + 'title' => $this->t('Display extender test settings'), 'column' => 'second', 'build' => array( '#weight' => -100, ), ); - $test_option = $this->displayHandler->getOption('test_extender_test_option') ?: t('Empty'); + $test_option = $this->displayHandler->getOption('test_extender_test_option') ?: $this->t('Empty'); $options['test_extender_test_option'] = array( 'category' => 'display_extender_test', - 'title' => t('Test option'), + 'title' => $this->t('Test option'), 'value' => views_ui_truncate($test_option, 24), ); } @@ -65,11 +65,11 @@ public function optionsSummary(&$categories, &$options) { public function buildOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'test_extender_test_option': - $form['#title'] .= t('Test option'); + $form['#title'] .= $this->t('Test option'); $form['test_extender_test_option'] = array( - '#title' => t('Test option'), + '#title' => $this->t('Test option'), '#type' => 'textfield', - '#description' => t('This is a textfield for test_option.'), + '#description' => $this->t('This is a textfield for test_option.'), '#default_value' => $this->displayHandler->getOption('test_extender_test_option'), ); } only in patch2: unchanged: --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php @@ -37,7 +37,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['test_enable'] = array( '#type' => 'checkbox', - '#title' => t('Controls whether the filter plugin should be active'), + '#title' => $this->t('Controls whether the filter plugin should be active'), '#default_value' => $this->options['test_enable'], ); } only in patch2: unchanged: --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php @@ -44,7 +44,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['test_setting'] = array( - '#title' => t('Test setting'), + '#title' => $this->t('Test setting'), '#type' => 'textfield', '#default_value' => $this->options['test_setting'], ); only in patch2: unchanged: --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php @@ -49,9 +49,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['test_option'] = array( - '#title' => t('Test option'), + '#title' => $this->t('Test option'), '#type' => 'textfield', - '#description' => t('This is a textfield for test_option.'), + '#description' => $this->t('This is a textfield for test_option.'), '#default_value' => $this->options['test_option'], ); } only in patch2: unchanged: --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php @@ -31,18 +31,18 @@ class MappingTest extends Mapping { protected function defineMapping() { return array( 'title_field' => array( - '#title' => t('Title field'), - '#description' => t('Choose the field with the custom title.'), + '#title' => $this->t('Title field'), + '#description' => $this->t('Choose the field with the custom title.'), '#toggle' => TRUE, '#required' => TRUE, ), 'name_field' => array( - '#title' => t('Name field'), - '#description' => t('Choose the field with the custom name.'), + '#title' => $this->t('Name field'), + '#description' => $this->t('Choose the field with the custom name.'), ), 'numeric_field' => array( - '#title' => t('Numeric field'), - '#description' => t('Select one or more numeric fields.'), + '#title' => $this->t('Numeric field'), + '#description' => $this->t('Select one or more numeric fields.'), '#multiple' => TRUE, '#toggle' => TRUE, '#filter' => 'filterNumericFields', only in patch2: unchanged: --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php @@ -57,9 +57,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['test_option'] = array( - '#title' => t('Test option'), + '#title' => $this->t('Test option'), '#type' => 'textfield', - '#description' => t('This is a textfield for test_option.'), + '#description' => $this->t('This is a textfield for test_option.'), '#default_value' => $this->options['test_option'], ); }