From b05c1be9d333913eb14546ec54f96371d2df8da0 Mon Sep 17 00:00:00 2001 From: Jeffrey Fortune <jfortune@tombras.com> Date: Mon, 11 Feb 2019 08:13:15 -0500 Subject: [PATCH] changed t() to ->t() when used in non static methods --- .../FieldFormatter/BgImgFieldFormatter.php | 5 +- src/Plugin/Field/FieldType/BgImgItem.php | 59 ++++++++++--------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/Plugin/Field/FieldFormatter/BgImgFieldFormatter.php b/src/Plugin/Field/FieldFormatter/BgImgFieldFormatter.php index 3fe63c6..5c2c585 100644 --- a/src/Plugin/Field/FieldFormatter/BgImgFieldFormatter.php +++ b/src/Plugin/Field/FieldFormatter/BgImgFieldFormatter.php @@ -140,10 +140,11 @@ class BgImgFieldFormatter extends ResponsiveImageFormatter implements ContainerF $responsive_image_style = $this->responsiveImageStyleStorage->load($this->getSetting('responsive_image_style')); if ($responsive_image_style) { - $summary[] = t('Responsive image style: @responsive_image_style', ['@responsive_image_style' => $responsive_image_style->label()]); + $summary[] = $this->t('Responsive image style: @responsive_image_style', + ['@responsive_image_style' => $responsive_image_style->label()]); } else { - $summary[] = t('Select a responsive image style.'); + $summary[] = $this->t('Select a responsive image style.'); } return $summary; diff --git a/src/Plugin/Field/FieldType/BgImgItem.php b/src/Plugin/Field/FieldType/BgImgItem.php index cfcb09c..cf638d0 100644 --- a/src/Plugin/Field/FieldType/BgImgItem.php +++ b/src/Plugin/Field/FieldType/BgImgItem.php @@ -139,8 +139,8 @@ class BgImgItem extends ImageItem { $elements['css_settings'] = [ '#type' => 'details', - '#title' => t('CSS Settings'), - '#description' => t('Set default CSS properties for the background image.'), + '#title' => $this->t('CSS Settings'), + '#description' => $this->t('Set default CSS properties for the background image.'), '#open' => FALSE, ]; @@ -153,8 +153,8 @@ class BgImgItem extends ImageItem { // The css selector input field needed to. $elements['css_settings']['css_selector'] = [ '#type' => 'textfield', - '#title' => t('Selector'), - '#description' => t('CSS Selector for background image.'), + '#title' => $this->t('Selector'), + '#description' => $this->t('CSS Selector for background image.'), '#default_value' => $css_option_settings['css_selector'], '#token_types' => $token_types, '#element_validate' => 'token_element_validate', @@ -171,55 +171,56 @@ class BgImgItem extends ImageItem { // User ability to select a background repeat option. $elements['css_settings']['css_repeat'] = [ '#type' => 'radios', - '#title' => t('Repeat Options'), - '#description' => t('Add the css no repeat value to the background image.'), + '#title' => $this->t('Repeat Options'), + '#description' => $this->t('Add the css no repeat value to the background image.'), '#default_value' => $css_option_settings['css_repeat'], '#options' => [ - "inherit" => t("inherit"), - "no-repeat" => t("no-repeat"), - "repeat" => t('repeat'), + "inherit" => $this->t("inherit"), + "no-repeat" => $this->t("no-repeat"), + "repeat" => $this->t('repeat'), ], ]; // User the ability to choose background size. $elements['css_settings']['css_background_size'] = [ '#type' => 'radios', - '#title' => t('Background Size'), - '#description' => t("Add the background size setting you would like for the image, use inherit for default."), + '#title' => $this->t('Background Size'), + '#description' => $this->t("Add the background size setting you would like for the image, use inherit for default."), '#default_value' => $css_option_settings['css_background_size'], '#options' => [ - 'inherit' => t('inherit'), - 'auto' => t('auto'), - 'cover' => t('cover'), - 'contain' => t('contain'), - 'initial' => t('initial'), + 'inherit' => $this->t('inherit'), + 'auto' => $this->t('auto'), + 'cover' => $this->t('cover'), + 'contain' => $this->t('contain'), + 'initial' => $this->t('initial'), ], ]; // User the ability to set the background position. $elements['css_settings']['css_background_position'] = [ '#type' => 'radios', - '#title' => t('Background Position'), - '#description' => t('Set a background position, leave unchecked to have your own in your theme css.'), + '#title' => $this->t('Background Position'), + '#description' => $this->t('Set a background position, leave unchecked to + # have your own in your theme css.'), '#default_value' => $css_option_settings['css_background_position'], '#options' => [ - "inherit" => t("inherit"), - "left top" => t("left top"), - "left center" => t("left center"), - "left bottom" => t("left bottom"), - "right top" => t("right bottom"), - "right center" => t("right center"), - "right bottom" => t("right bottom"), - "center top" => t("center top"), - "center center" => t("center center"), - "center bottom" => t("center bottom"), + "inherit" => $this->t("inherit"), + "left top" => $this->t("left top"), + "left center" => $this->t("left center"), + "left bottom" => $this->t("left bottom"), + "right top" => $this->t("right bottom"), + "right center" => $this->t("right center"), + "right bottom" => $this->t("right bottom"), + "center top" => $this->t("center top"), + "center center" => $this->t("center center"), + "center bottom" => $this->t("center bottom"), ], '#tree' => TRUE, ]; $elements['file_settings'] = [ '#type' => 'details', - '#title' => t("File Settings"), + '#title' => $this->t("File Settings"), '#open' => FALSE, ] + $parentElements; -- GitLab