diff --git a/core/lib/Drupal/Core/Block/BlockBase.php b/core/lib/Drupal/Core/Block/BlockBase.php index 6266502..9c29621 100644 --- a/core/lib/Drupal/Core/Block/BlockBase.php +++ b/core/lib/Drupal/Core/Block/BlockBase.php @@ -231,7 +231,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta $form['admin_label'] = array( '#type' => 'item', - '#title' => t('Block description'), + '#title' => $this->t('Block description'), '#markup' => $definition['admin_label'], ); $form['label'] = array( @@ -251,16 +251,16 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta // @see \Drupal\system\Form\PerformanceForm::buildForm() $period = array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400); $period = array_map(array(\Drupal::service('date.formatter'), 'formatInterval'), array_combine($period, $period)); - $period[0] = '<' . t('no caching') . '>'; - $period[\Drupal\Core\Cache\Cache::PERMANENT] = t('Forever'); + $period[0] = '<' . $this->t('no caching') . '>'; + $period[\Drupal\Core\Cache\Cache::PERMANENT] = $this->t('Forever'); $form['cache'] = array( '#type' => 'details', - '#title' => t('Cache settings'), + '#title' => $this->t('Cache settings'), ); $form['cache']['max_age'] = array( '#type' => 'select', - '#title' => t('Maximum age'), - '#description' => t('The maximum time this block may be cached.'), + '#title' => $this->t('Maximum age'), + '#description' => $this->t('The maximum time this block may be cached.'), '#default_value' => $this->configuration['cache']['max_age'], '#options' => $period, ); @@ -270,8 +270,8 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta unset($contexts['cache_context.theme']); $form['cache']['contexts'] = array( '#type' => 'checkboxes', - '#title' => t('Vary by context'), - '#description' => t('The contexts this cached block must be varied by.'), + '#title' => $this->t('Vary by context'), + '#description' => $this->t('The contexts this cached block must be varied by.'), '#default_value' => $this->configuration['cache']['contexts'], '#options' => $contexts, '#states' => array( @@ -289,7 +289,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta unset($form['cache']['contexts']['#options'][$context]); } $required_context_list = implode(', ', $context_labels); - $form['cache']['contexts']['#description'] .= ' ' . t('This block is always varied by the following contexts: %required-context-list.', array('%required-context-list' => $required_context_list)); + $form['cache']['contexts']['#description'] .= ' ' . $this->t('This block is always varied by the following contexts: %required-context-list.', array('%required-context-list' => $required_context_list)); } $form['visibility_tabs'] = array( diff --git a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php index 65f95f1..db8aea6 100644 --- a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php +++ b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php @@ -125,14 +125,14 @@ public function blockForm($form, FormStateInterface $form_state) { } $form['feed'] = array( '#type' => 'select', - '#title' => t('Select the feed that should be displayed'), + '#title' => $this->t('Select the feed that should be displayed'), '#default_value' => $this->configuration['feed'], '#options' => $options, ); $range = range(2, 20); $form['block_count'] = array( '#type' => 'select', - '#title' => t('Number of news items in block'), + '#title' => $this->t('Number of news items in block'), '#default_value' => $this->configuration['block_count'], '#options' => array_combine($range, $range), ); diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php index 7390bc5..e9b4144 100644 --- a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php +++ b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php @@ -43,7 +43,7 @@ protected function blockAccess(AccountInterface $account) { public function blockForm($form, FormStateInterface $form_state) { $form['display_message'] = array( '#type' => 'textfield', - '#title' => t('Display message'), + '#title' => $this->t('Display message'), '#default_value' => $this->configuration['display_message'], ); return $form; diff --git a/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php b/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php index 9e40c81..d72d7bf 100644 --- a/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php +++ b/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php @@ -125,11 +125,11 @@ public function blockForm($form, FormStateInterface $form_state) { $form['block_content']['view_mode'] = array( '#type' => 'select', '#options' => $this->entityManager->getViewModeOptions('block_content'), - '#title' => t('View mode'), - '#description' => t('Output the block in this view mode.'), + '#title' => $this->t('View mode'), + '#description' => $this->t('Output the block in this view mode.'), '#default_value' => $this->configuration['view_mode'] ); - $form['title']['#description'] = t('The title of the block as shown to the user.'); + $form['title']['#description'] = $this->t('The title of the block as shown to the user.'); return $form; } @@ -154,7 +154,7 @@ public function build() { } else { return array( - '#markup' => t('Block with uuid %uuid does not exist. Add custom block.', array( + '#markup' => $this->t('Block with uuid %uuid does not exist. Add custom block.', array( '%uuid' => $uuid, '!url' => url('block/add') )), diff --git a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php index 441d052..0727377 100644 --- a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php +++ b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php @@ -87,15 +87,15 @@ public function defaultConfiguration() { */ function blockForm($form, FormStateInterface $form_state) { $options = array( - 'all pages' => t('Show block on all pages'), - 'book pages' => t('Show block only on book pages'), + 'all pages' => $this->t('Show block on all pages'), + 'book pages' => $this->t('Show block only on book pages'), ); $form['book_block_mode'] = array( '#type' => 'radios', - '#title' => t('Book navigation block display'), + '#title' => $this->t('Book navigation block display'), '#options' => $options, '#default_value' => $this->configuration['block_mode'], - '#description' => t("If Show block on all pages is selected, the block will contain the automatically generated menus for all of the site's books. If Show block only on book pages is selected, the block will contain only the one menu corresponding to the current page's book. In this case, if the current page is not in a book, no block will be displayed. The Page specific visibility settings or other visibility settings can be used in addition to selectively display this block."), + '#description' => $this->t("If Show block on all pages is selected, the block will contain the automatically generated menus for all of the site's books. If Show block only on book pages is selected, the block will contain only the one menu corresponding to the current page's book. In this case, if the current page is not in a book, no block will be displayed. The Page specific visibility settings or other visibility settings can be used in addition to selectively display this block."), ); return $form; diff --git a/core/modules/forum/src/Plugin/Block/ForumBlockBase.php b/core/modules/forum/src/Plugin/Block/ForumBlockBase.php index f480892..4840f70 100644 --- a/core/modules/forum/src/Plugin/Block/ForumBlockBase.php +++ b/core/modules/forum/src/Plugin/Block/ForumBlockBase.php @@ -68,7 +68,7 @@ public function blockForm($form, FormStateInterface $form_state) { $range = range(2, 20); $form['block_count'] = array( '#type' => 'select', - '#title' => t('Number of topics'), + '#title' => $this->t('Number of topics'), '#default_value' => $this->configuration['block_count'], '#options' => array_combine($range, $range), ); diff --git a/core/modules/node/src/Plugin/Block/SyndicateBlock.php b/core/modules/node/src/Plugin/Block/SyndicateBlock.php index f4e7123..436a570 100644 --- a/core/modules/node/src/Plugin/Block/SyndicateBlock.php +++ b/core/modules/node/src/Plugin/Block/SyndicateBlock.php @@ -56,7 +56,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta // @see ::isCacheable() $form['cache']['#disabled'] = TRUE; - $form['cache']['#description'] = t('This block is never cacheable, it is not configurable.'); + $form['cache']['#description'] = $this->t('This block is never cacheable, it is not configurable.'); $form['cache']['max_age']['#value'] = 0; return $form; diff --git a/core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php b/core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php index 5e42e1c..e8c2fbb 100644 --- a/core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php +++ b/core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php @@ -59,15 +59,15 @@ public function defaultConfiguration() { protected function blockAccess(AccountInterface $account) { if ($account->hasPermission('access content')) { $daytop = $this->configuration['top_day_num']; - if (!$daytop || !($result = statistics_title_list('daycount', $daytop)) || !($this->day_list = node_title_list($result, t("Today's:")))) { + if (!$daytop || !($result = statistics_title_list('daycount', $daytop)) || !($this->day_list = node_title_list($result, $this->t("Today's:")))) { return FALSE; } $alltimetop = $this->configuration['top_all_num']; - if (!$alltimetop || !($result = statistics_title_list('totalcount', $alltimetop)) || !($this->all_time_list = node_title_list($result, t('All time:')))) { + if (!$alltimetop || !($result = statistics_title_list('totalcount', $alltimetop)) || !($this->all_time_list = node_title_list($result, $this->t('All time:')))) { return FALSE; } $lasttop = $this->configuration['top_last_num']; - if (!$lasttop || !($result = statistics_title_list('timestamp', $lasttop)) || !($this->last_list = node_title_list($result, t('Last viewed:')))) { + if (!$lasttop || !($result = statistics_title_list('timestamp', $lasttop)) || !($this->last_list = node_title_list($result, $this->t('Last viewed:')))) { return FALSE; } return TRUE; @@ -81,27 +81,27 @@ protected function blockAccess(AccountInterface $account) { public function blockForm($form, FormStateInterface $form_state) { // Popular content block settings. $numbers = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40); - $numbers = array('0' => t('Disabled')) + array_combine($numbers, $numbers); + $numbers = array('0' => $this->t('Disabled')) + array_combine($numbers, $numbers); $form['statistics_block_top_day_num'] = array( '#type' => 'select', - '#title' => t("Number of day's top views to display"), + '#title' => $this->t("Number of day's top views to display"), '#default_value' => $this->configuration['top_day_num'], '#options' => $numbers, - '#description' => t('How many content items to display in "day" list.'), + '#description' => $this->t('How many content items to display in "day" list.'), ); $form['statistics_block_top_all_num'] = array( '#type' => 'select', - '#title' => t('Number of all time views to display'), + '#title' => $this->t('Number of all time views to display'), '#default_value' => $this->configuration['top_all_num'], '#options' => $numbers, - '#description' => t('How many content items to display in "all time" list.'), + '#description' => $this->t('How many content items to display in "all time" list.'), ); $form['statistics_block_top_last_num'] = array( '#type' => 'select', - '#title' => t('Number of most recent views to display'), + '#title' => $this->t('Number of most recent views to display'), '#default_value' => $this->configuration['top_last_num'], '#options' => $numbers, - '#description' => t('How many content items to display in "recently viewed" list.'), + '#description' => $this->t('How many content items to display in "recently viewed" list.'), ); return $form; } diff --git a/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php b/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php index f50a287..247915c 100644 --- a/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php @@ -169,7 +169,7 @@ public function build() { $build['site_logo'] = array( '#theme' => 'image', '#uri' => $logo['url'], - '#alt' => t('Home'), + '#alt' => $this->t('Home'), '#access' => $this->configuration['use_site_logo'], ); diff --git a/core/modules/system/src/Plugin/Block/SystemMainBlock.php b/core/modules/system/src/Plugin/Block/SystemMainBlock.php index 4504081..fb0a734 100644 --- a/core/modules/system/src/Plugin/Block/SystemMainBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemMainBlock.php @@ -37,7 +37,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta // The main content block is never cacheable, because it may be dynamic. $form['cache']['#disabled'] = TRUE; - $form['cache']['#description'] = t('This block is never cacheable, it is not configurable.'); + $form['cache']['#description'] = $this->t('This block is never cacheable, it is not configurable.'); $form['cache']['max_age']['#value'] = 0; return $form; diff --git a/core/modules/system/src/Plugin/Block/SystemMenuBlock.php b/core/modules/system/src/Plugin/Block/SystemMenuBlock.php index d2c0270..6067311 100644 --- a/core/modules/system/src/Plugin/Block/SystemMenuBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemMenuBlock.php @@ -84,7 +84,7 @@ public function blockForm($form, FormStateInterface $form_state) { $defaults = $this->defaultConfiguration(); $form['menu_levels'] = array( '#type' => 'details', - '#title' => t('Menu levels'), + '#title' => $this->t('Menu levels'), // Open if not set to defaults. '#open' => $defaults['level'] !== $config['level'] || $defaults['depth'] !== $config['depth'], '#process' => [[get_class(), 'processMenuLevelParents']], diff --git a/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php b/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php index c18f1c8..25e244d 100644 --- a/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php @@ -25,7 +25,7 @@ class SystemPoweredByBlock extends BlockBase { * {@inheritdoc} */ public function build() { - return array('#markup' => '' . t('Powered by Drupal', array('@poweredby' => 'https://www.drupal.org')) . ''); + return array('#markup' => '' . $this->t('Powered by Drupal', array('@poweredby' => 'https://www.drupal.org')) . ''); } /** @@ -38,7 +38,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta // contents can never change. $form['cache']['#disabled'] = TRUE; $form['cache']['max_age']['#value'] = Cache::PERMANENT; - $form['cache']['#description'] = t('This block is always cached forever, it is not configurable.'); + $form['cache']['#description'] = $this->t('This block is always cached forever, it is not configurable.'); return $form; } diff --git a/core/modules/user/src/Plugin/Block/UserLoginBlock.php b/core/modules/user/src/Plugin/Block/UserLoginBlock.php index 7b3727d..926eec9 100644 --- a/core/modules/user/src/Plugin/Block/UserLoginBlock.php +++ b/core/modules/user/src/Plugin/Block/UserLoginBlock.php @@ -44,16 +44,16 @@ public function build() { // Build action links. $items = array(); if (\Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) { - $items['create_account'] = l(t('Create new account'), 'user/register', array( + $items['create_account'] = l($this->t('Create new account'), 'user/register', array( 'attributes' => array( - 'title' => t('Create a new user account.'), + 'title' => $this->t('Create a new user account.'), 'class' => array('create-account-link'), ), )); } - $items['request_password'] = l(t('Request new password'), 'user/password', array( + $items['request_password'] = l($this->t('Request new password'), 'user/password', array( 'attributes' => array( - 'title' => t('Request new password via email.'), + 'title' => $this->t('Request new password via email.'), 'class' => array('request-password-link'), ), ));