Commit 957971c0 authored by Roman Khimin's avatar Roman Khimin Committed by Jonathan Sacksick
Browse files

Issue #3125645 by neelam_wadhwani, chakkche, anabpv, khiminrm, prabha1997,...

Issue #3125645 by neelam_wadhwani, chakkche, anabpv, khiminrm, prabha1997, jsacksick, andregp: t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead.
parent a193d3d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ class ShippingMethodForm extends ContentEntityForm {
    if ($store_query->count()->execute() == 0) {
      $link = Link::createFromRoute('Add a new store.', 'entity.commerce_store.add_page');
      $form['warning'] = [
        '#markup' => t("Shipping methods can't be created until a store has been added. @link", ['@link' => $link->toString()]),
        '#markup' => $this->t("Shipping methods can't be created until a store has been added. @link", ['@link' => $link->toString()]),
      ];
      return $form;
    }
+4 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ use Drupal\commerce_order\Adjustment;
use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\commerce_order\OrderProcessorInterface;
use Drupal\commerce_shipping\Entity\ShipmentInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;

/**
 * Completes the order refresh process for shipments.
@@ -19,6 +20,8 @@ use Drupal\commerce_shipping\Entity\ShipmentInterface;
 */
class LateOrderProcessor implements OrderProcessorInterface {

  use StringTranslationTrait;

  /**
   * The shipping order manager.
   *
@@ -56,7 +59,7 @@ class LateOrderProcessor implements OrderProcessorInterface {
        // Shipments without an amount are incomplete / unrated.
        $order->addAdjustment(new Adjustment([
          'type' => 'shipping',
          'label' => $single_shipment ? t('Shipping') : $shipment->getTitle(),
          'label' => $single_shipment ? $this->t('Shipping') : $shipment->getTitle(),
          'amount' => $amount,
          'source_id' => $shipment->id(),
        ]));
+2 −0
Original line number Diff line number Diff line
@@ -12,11 +12,13 @@ use Drupal\physical\Calculator;
use Drupal\physical\Weight;
use Drupal\physical\WeightUnit;
use Drupal\profile\Entity\ProfileInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;

/**
 * Creates a single shipment per order.
 */
class DefaultPacker implements PackerInterface {
  use StringTranslationTrait;

  use StringTranslationTrait;

+5 −5
Original line number Diff line number Diff line
@@ -66,20 +66,20 @@ class FlatRate extends ShippingMethodBase {

    $form['rate_label'] = [
      '#type' => 'textfield',
      '#title' => t('Rate label'),
      '#description' => t('Shown to customers when selecting the rate.'),
      '#title' => $this->t('Rate label'),
      '#description' => $this->t('Shown to customers when selecting the rate.'),
      '#default_value' => $this->configuration['rate_label'],
      '#required' => TRUE,
    ];
    $form['rate_description'] = [
      '#type' => 'textfield',
      '#title' => t('Rate description'),
      '#description' => t('Provides additional details about the rate to the customer.'),
      '#title' => $this->t('Rate description'),
      '#description' => $this->t('Provides additional details about the rate to the customer.'),
      '#default_value' => $this->configuration['rate_description'],
    ];
    $form['rate_amount'] = [
      '#type' => 'commerce_price',
      '#title' => t('Rate amount'),
      '#title' => $this->t('Rate amount'),
      '#default_value' => $amount,
      '#required' => TRUE,
    ];
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ class Shipping extends TaxTypeBase {
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form['strategy'] = [
      '#type' => 'radios',
      '#title' => t('Strategy'),
      '#title' => $this->t('Strategy'),
      '#options' => [
        'default' => $this->t("Apply the default (standard) rate of the order's tax type"),
        'highest' => $this->t('Apply the highest rate found on the order'),
Loading