diff --git a/core/lib/Drupal/Core/Access/AccessResultInterface.php b/core/lib/Drupal/Core/Access/AccessResultInterface.php index 7d02314..14bb204 100644 --- 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. * diff --git a/core/modules/aggregator/src/Plugin/views/field/TitleLink.php b/core/modules/aggregator/src/Plugin/views/field/TitleLink.php index 9ab50bf..4fb924f 100644 --- 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']), ); diff --git a/core/modules/aggregator/src/Plugin/views/row/Rss.php b/core/modules/aggregator/src/Plugin/views/row/Rss.php index ff59828..ed1393e 100644 --- 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'], ); diff --git a/core/modules/comment/src/Plugin/views/argument/UserUid.php b/core/modules/comment/src/Plugin/views/argument/UserUid.php index 5e104bd..77ed0cc 100644 --- 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')); } } diff --git a/core/modules/comment/src/Plugin/views/field/Comment.php b/core/modules/comment/src/Plugin/views/field/Comment.php index c82eceb..f7f6673 100644 --- 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'], ); diff --git a/core/modules/comment/src/Plugin/views/field/EntityLink.php b/core/modules/comment/src/Plugin/views/field/EntityLink.php index c1dae39..b05c1eb 100644 --- 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); diff --git a/core/modules/comment/src/Plugin/views/field/Link.php b/core/modules/comment/src/Plugin/views/field/Link.php index 30cfd31..b1a9877 100644 --- 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(); diff --git a/core/modules/comment/src/Plugin/views/field/LinkApprove.php b/core/modules/comment/src/Plugin/views/field/LinkApprove.php index 1fde0a7..095eacd 100644 --- 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; diff --git a/core/modules/comment/src/Plugin/views/field/LinkDelete.php b/core/modules/comment/src/Plugin/views/field/LinkDelete.php index ada595f..f22563b 100644 --- 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; diff --git a/core/modules/comment/src/Plugin/views/field/LinkEdit.php b/core/modules/comment/src/Plugin/views/field/LinkEdit.php index 7637143..cd74a59 100644 --- 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'])) { diff --git a/core/modules/comment/src/Plugin/views/field/LinkReply.php b/core/modules/comment/src/Plugin/views/field/LinkReply.php index ba13f1e..d9f6914 100644 --- 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; diff --git a/core/modules/comment/src/Plugin/views/field/NodeComment.php b/core/modules/comment/src/Plugin/views/field/NodeComment.php index a7c1c44..45a9deb 100644 --- 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'); } } diff --git a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php index 748291b..6bf1607 100644 --- 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'], ); diff --git a/core/modules/comment/src/Plugin/views/field/Username.php b/core/modules/comment/src/Plugin/views/field/Username.php index b526dbc..cb066ba 100644 --- 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'], ); diff --git a/core/modules/comment/src/Plugin/views/filter/NodeComment.php b/core/modules/comment/src/Plugin/views/filter/NodeComment.php index fe041bd..cdb2496 100644 --- 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'), ); } diff --git a/core/modules/comment/src/Plugin/views/row/Rss.php b/core/modules/comment/src/Plugin/views/row/Rss.php index 50354fb..010cd42 100644 --- 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; } diff --git a/core/modules/comment/src/Plugin/views/wizard/Comment.php b/core/modules/comment/src/Plugin/views/wizard/Comment.php index 0c18266..f88e43f 100644 --- 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, ); diff --git a/core/modules/contact/src/Plugin/views/field/ContactLink.php b/core/modules/contact/src/Plugin/views/field/ContactLink.php index 50c3191..118380d 100644 --- 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'])) { diff --git a/core/modules/content_translation/src/Plugin/views/field/TranslationLink.php b/core/modules/content_translation/src/Plugin/views/field/TranslationLink.php index f800e37..4e3c93b 100644 --- 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'); diff --git a/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php b/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php index e7e5238..b0affe8 100644 --- 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'], ); diff --git a/core/modules/dblog/src/Plugin/views/field/DblogMessage.php b/core/modules/dblog/src/Plugin/views/field/DblogMessage.php index 6c94184..408dd20 100644 --- 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'], ); diff --git a/core/modules/entity_reference/src/Plugin/views/display/EntityReference.php b/core/modules/entity_reference/src/Plugin/views/display/EntityReference.php index beeb095..83f998f 100644 --- 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)); } } } diff --git a/core/modules/entity_reference/src/Plugin/views/row/EntityReference.php b/core/modules/entity_reference/src/Plugin/views/row/EntityReference.php index 8434e97..3323933 100644 --- 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." ); } /** diff --git a/core/modules/entity_reference/src/Plugin/views/style/EntityReference.php b/core/modules/entity_reference/src/Plugin/views/style/EntityReference.php index 258e66e..51c45a8 100644 --- 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, ); } diff --git a/core/modules/field/src/Plugin/views/argument/FieldList.php b/core/modules/field/src/Plugin/views/argument/FieldList.php index 14e8219..b25b248 100644 --- 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( diff --git a/core/modules/field/src/Plugin/views/argument/ListString.php b/core/modules/field/src/Plugin/views/argument/ListString.php index e78a9f7..44d2ff9 100644 --- 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( diff --git a/core/modules/field/src/Plugin/views/field/Field.php b/core/modules/field/src/Plugin/views/field/Field.php index 7788a5b..483a90a 100644 --- 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)); } } diff --git a/core/modules/file/src/Plugin/views/field/Extension.php b/core/modules/file/src/Plugin/views/field/Extension.php index ba53c81..c3b99ad 100644 --- 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'], ); } diff --git a/core/modules/file/src/Plugin/views/field/File.php b/core/modules/file/src/Plugin/views/field/File.php index 135ff7f..aec9748 100644 --- 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']), ); diff --git a/core/modules/file/src/Plugin/views/field/FileMime.php b/core/modules/file/src/Plugin/views/field/FileMime.php index 5576e34..d80e147 100644 --- 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']), ); diff --git a/core/modules/file/src/Plugin/views/field/Uri.php b/core/modules/file/src/Plugin/views/field/Uri.php index 2d2c481..f5e18e9 100644 --- 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']), ); diff --git a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php index 4a7d0c1..7adbb53 100644 --- 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']), ); } diff --git a/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php b/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php index f25f53c..f72de1d 100644 --- 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'); } } diff --git a/core/modules/node/src/Plugin/views/argument/Type.php b/core/modules/node/src/Plugin/views/argument/Type.php index 42a14a6..e64ff6f 100644 --- 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); } diff --git a/core/modules/node/src/Plugin/views/field/Language.php b/core/modules/node/src/Plugin/views/field/Language.php index 9f7ff51..16de1bb 100644 --- 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'), ); } diff --git a/core/modules/node/src/Plugin/views/field/Link.php b/core/modules/node/src/Plugin/views/field/Link.php index b276747..8767b3a 100644 --- 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; } } diff --git a/core/modules/node/src/Plugin/views/field/LinkDelete.php b/core/modules/node/src/Plugin/views/field/LinkDelete.php index 78bb9dc..c5cf1f7 100644 --- 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; } diff --git a/core/modules/node/src/Plugin/views/field/LinkEdit.php b/core/modules/node/src/Plugin/views/field/LinkEdit.php index cf8a057..b59a389 100644 --- 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; } diff --git a/core/modules/node/src/Plugin/views/field/Node.php b/core/modules/node/src/Plugin/views/field/Node.php index ae74239..8fd95af 100644 --- 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']), ); diff --git a/core/modules/node/src/Plugin/views/field/NodeBulkForm.php b/core/modules/node/src/Plugin/views/field/NodeBulkForm.php index d1b4caf..1f8a247 100644 --- 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.'); } } diff --git a/core/modules/node/src/Plugin/views/field/Path.php b/core/modules/node/src/Plugin/views/field/Path.php index 53b5010..33c67d7 100644 --- 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', ); } diff --git a/core/modules/node/src/Plugin/views/field/Revision.php b/core/modules/node/src/Plugin/views/field/Revision.php index 040c63f..e95e3e3 100644 --- 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']), ); diff --git a/core/modules/node/src/Plugin/views/field/RevisionLink.php b/core/modules/node/src/Plugin/views/field/RevisionLink.php index 5ea0835..0298a5d 100644 --- 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'); } /** diff --git a/core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php b/core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php index a09c00c..dfc6891 100644 --- 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'); } } diff --git a/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php b/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php index f4f59ff..2ceb19f 100644 --- 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'); } } diff --git a/core/modules/node/src/Plugin/views/field/Type.php b/core/modules/node/src/Plugin/views/field/Type.php index 4824227..bae0fb5 100644 --- 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); } diff --git a/core/modules/node/src/Plugin/views/row/Rss.php b/core/modules/node/src/Plugin/views/row/Rss.php index 04aff57..9c501a7 100644 --- 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; } diff --git a/core/modules/node/src/Plugin/views/wizard/Node.php b/core/modules/node/src/Plugin/views/wizard/Node.php index 9da3633..05ba0d1 100644 --- 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, diff --git a/core/modules/rest/src/Plugin/views/display/RestExport.php b/core/modules/rest/src/Plugin/views/display/RestExport.php index d4f3d34..51b070b 100644 --- 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. diff --git a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php index 52e6edd..980f80c 100644 --- 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')); } } diff --git a/core/modules/rest/src/Plugin/views/style/Serializer.php b/core/modules/rest/src/Plugin/views/style/Serializer.php index e32e332..51366bd 100644 --- 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'], ); diff --git a/core/modules/search/src/Plugin/views/filter/Search.php b/core/modules/search/src/Plugin/views/filter/Search.php index 1f8d193..a061fc1 100644 --- 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'), diff --git a/core/modules/search/src/Plugin/views/row/SearchRow.php b/core/modules/search/src/Plugin/views/row/SearchRow.php index c93efda..267ed1d 100644 --- 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'], ); } diff --git a/core/modules/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php index c1b2b73..f62a3b9 100644 --- a/core/modules/system/src/Form/ModulesListForm.php +++ b/core/modules/system/src/Form/ModulesListForm.php @@ -194,19 +194,22 @@ public function buildForm(array $form, FormStateInterface $form_state) { // Add a wrapper around every package. foreach (Element::children($form['modules']) as $package) { - $form['modules'][$package] += array( - '#type' => 'details', - '#title' => $this->t($package), - '#open' => TRUE, - '#theme' => 'system_modules_details', + $table = array( + '#type' => 'table', '#header' => array( array('data' => $this->t('Installed'), 'class' => array('checkbox', 'visually-hidden')), array('data' => $this->t('Name'), 'class' => array('name', 'visually-hidden')), array('data' => $this->t('Description'), 'class' => array('description', 'visually-hidden', RESPONSIVE_PRIORITY_LOW)), ), - '#attributes' => array('class' => array('package-listing')), + ) + $form['modules'][$package]; + $form['modules'][$package] = array( + '#type' => 'details', + '#title' => $this->t($package), + '#open' => TRUE, // Ensure that the "Core" package comes first. '#weight' => $package == 'Core' ? -10 : NULL, + '#attributes' => array('class' => array('package-listing')), + 'table' => $table, ); } @@ -243,31 +246,33 @@ public function buildForm(array $form, FormStateInterface $form_state) { */ protected function buildRow(array $modules, Extension $module, $distribution) { // Set the basic properties. - $row['#required'] = array(); + $row['#version'] = $module->info['version']; $row['#requires'] = array(); $row['#required_by'] = array(); - $row['name']['#markup'] = $module->info['name']; - $row['description']['#markup'] = $this->t($module->info['description']); - $row['version']['#markup'] = $module->info['version']; - // Generate link for module's help page, if there is one. - $row['links']['help'] = array(); + $row_links['help'] = array(); if ($this->moduleHandler->moduleExists('help') && $module->status && in_array($module->getName(), $this->moduleHandler->getImplementations('help'))) { if ($this->moduleHandler->invoke($module->getName(), 'help', array('help.page.' . $module->getName(), $this->routeMatch))) { - $row['links']['help'] = array( + $row_links['help'] = array( '#type' => 'link', '#title' => $this->t('Help'), '#href' => 'admin/help/' . $module->getName(), - '#options' => array('attributes' => array('class' => array('module-link', 'module-link-help'), 'title' => $this->t('Help'))), + '#options' => array( + 'attributes' => array( + 'id' => 'edit-modules-core-' . $module->getName() . '-links-help', + 'class' => array('module-link', 'module-link-help'), + 'title' => $this->t('Help'), + ), + ), ); } } // Generate link for module's permission, if the user has access to it. - $row['links']['permissions'] = array(); + $row_links['permissions'] = array(); if ($module->status && \Drupal::currentUser()->hasPermission('administer permissions') && in_array($module->getName(), $this->moduleHandler->getImplementations('permission'))) { - $row['links']['permissions'] = array( + $row_links['permissions'] = array( '#type' => 'link', '#title' => $this->t('Permissions'), '#href' => 'admin/people/permissions', @@ -276,7 +281,7 @@ protected function buildRow(array $modules, Extension $module, $distribution) { } // Generate link for module's configuration page, if it has one. - $row['links']['configure'] = array(); + $row_links['configure'] = array(); if ($module->status && isset($module->info['configure'])) { $route_parameters = isset($module->info['configure_parameters']) ? $module->info['configure_parameters'] : array(); if ($this->accessManager->checkNamedRoute($module->info['configure'], $route_parameters, $this->currentUser)) { @@ -298,7 +303,7 @@ protected function buildRow(array $modules, Extension $module, $distribution) { $description = $this->titleResolver->getTitle($request, $route_object); } - $row['links']['configure'] = array( + $row_links['configure'] = array( '#type' => 'link', '#title' => $this->t('Configure'), '#route_name' => $module->info['configure'], @@ -316,7 +321,7 @@ protected function buildRow(array $modules, Extension $module, $distribution) { // Present a checkbox for installing and indicating the status of a module. $row['enable'] = array( '#type' => 'checkbox', - '#title' => $this->t('Install'), + '#wrapper_attributes' => array('class' => array('checkbox')), '#default_value' => (bool) $module->status, '#disabled' => (bool) $module->status, ); @@ -410,6 +415,64 @@ protected function buildRow(array $modules, Extension $module, $distribution) { } } + // Set id for checkbox here so module label can reference it. + $id = drupal_html_class('edit-modules-' . $module->info['package'] . '-' . $module->getName() . '-enable'); + + $row['name']['#markup'] = $module->info['name']; + + $row['enable'] += array( + '#id' => $id, + '#parents' => array('modules', $module->info['package'], $module->getName(), 'enable'), + ); + + // Add the module label and expand/collapse functionality. + $row['name'] = array( + '#prefix' => '', + '#wrapper_attributes' => array( + 'class' => array('module'), + ), + ); + + // Add the description, along with any modules it requires. + $description = ''; + if ($module->info['version'] || $row['#requires'] || $row['#required_by']) { + $description .= '
'; + if ($module->info['version']) { + $description .= '
' . $this->t('Version: !module-version', array('!module-version' => $module->info['version'])) . '
'; + } + if ($row['#requires']) { + $description .= '
' . $this->t('Requires: !module-list', array('!module-list' => implode(', ', $row['#requires']))) . '
'; + } + if ($row['#required_by']) { + $description .= '
' . $this->t('Required by: !module-list', array('!module-list' => implode(', ', $row['#required_by']))) . '
'; + } + $description .= '
'; + } + + $links = ''; + foreach (array('help', 'permissions', 'configure') as $key) { + $links .= (isset($row_links[$key]) ? drupal_render($row_links[$key]) : ''); + } + + if ($links) { + $description .= ' '; + } + + $row['description'] = array( + '#type' => 'details', + '#title' => $this->t(' ' . $module->info['description'] . ''), + '#attributes' => array('id' => $id . '-description'), + '#description' => t($description), + '#collapsed' => TRUE, + '#wrapper_attributes' => array( + 'class' => array('description', 'expand'), + ), + ); + return $row; } @@ -442,6 +505,7 @@ protected function buildModuleList(FormStateInterface $form_state) { // First, build a list of all modules that were selected. foreach ($packages as $items) { + unset($items['table']); foreach ($items as $name => $checkbox) { if ($checkbox['enable'] && !$this->moduleHandler->moduleExists($name)) { $modules['install'][$name] = $data[$name]->info['name']; diff --git a/core/modules/system/src/Form/ModulesUninstallForm.php b/core/modules/system/src/Form/ModulesUninstallForm.php index 4285956..6b20ef0 100644 --- a/core/modules/system/src/Form/ModulesUninstallForm.php +++ b/core/modules/system/src/Form/ModulesUninstallForm.php @@ -98,7 +98,22 @@ public function buildForm(array $form, FormStateInterface $form_state) { ), ); - $form['modules'] = array(); + $profile = drupal_get_profile(); + + // Sort all modules by their name. + if(!empty($uninstallable)) { + uasort($uninstallable, 'system_sort_modules_by_info_name'); + } + + $form['uninstall'] = array( + '#type' => 'table', + '#header' => array( + 'title' => array('data' => $this->t('Name')), + 'description' => array('data' => $this->t('Description')), + ), + '#empty' => $this->t('There are no items available to uninstall.'), + '#tableselect' => TRUE, + ); // Only build the rest of the form if there are any modules available to // uninstall; @@ -106,34 +121,40 @@ public function buildForm(array $form, FormStateInterface $form_state) { return $form; } - $profile = drupal_get_profile(); - - // Sort all modules by their name. - uasort($uninstallable, 'system_sort_modules_by_info_name'); - - $form['uninstall'] = array('#tree' => TRUE); foreach ($uninstallable as $module) { - $name = $module->info['name'] ?: $module->getName(); - $form['modules'][$module->getName()]['#module_name'] = $name; - $form['modules'][$module->getName()]['name']['#markup'] = $name; - $form['modules'][$module->getName()]['description']['#markup'] = $this->t($module->info['description']); - - $form['uninstall'][$module->getName()] = array( - '#type' => 'checkbox', - '#title' => $this->t('Uninstall @module module', array('@module' => $name)), - '#title_display' => 'invisible', + // Define