66use Drupal \commerce \PurchasableEntityInterface ;
77use Drupal \commerce_price \NumberFormatterFactoryInterface ;
88use Drupal \commerce_price \Resolver \ChainPriceResolverInterface ;
9- use Drupal \commerce_store \StoreContextInterface ;
9+ use Drupal \commerce_store \CurrentStoreInterface ;
1010use Drupal \Core \Cache \Cache ;
1111use Drupal \Core \Entity \EntityTypeManagerInterface ;
1212use Drupal \Core \Field \FieldDefinitionInterface ;
@@ -51,11 +51,11 @@ class PriceCalculatedFormatter extends PriceDefaultFormatter implements Containe
5151 protected $ currentUser ;
5252
5353 /**
54- * The store context .
54+ * The current store .
5555 *
56- * @var \Drupal\commerce_store\StoreContextInterface
56+ * @var \Drupal\commerce_store\CurrentStoreInterface
5757 */
58- protected $ storeContext ;
58+ protected $ currentStore ;
5959
6060 /**
6161 * Constructs a new PriceCalculatedFormatter object.
@@ -80,16 +80,16 @@ class PriceCalculatedFormatter extends PriceDefaultFormatter implements Containe
8080 * The number formatter factory.
8181 * @param \Drupal\commerce_price\Resolver\ChainPriceResolverInterface $chain_price_resolver
8282 * The chain price resolver.
83- * @param \Drupal\commerce_store\StoreContextInterface $store_context
84- * The store context .
83+ * @param \Drupal\commerce_store\CurrentStoreInterface $current_store
84+ * The current store .
8585 * @param \Drupal\Core\Session\AccountInterface $current_user
8686 * The current user.
8787 */
88- public function __construct ($ plugin_id , $ plugin_definition , FieldDefinitionInterface $ field_definition , array $ settings , $ label , $ view_mode , array $ third_party_settings , EntityTypeManagerInterface $ entity_type_manager , NumberFormatterFactoryInterface $ number_formatter_factory , ChainPriceResolverInterface $ chain_price_resolver , StoreContextInterface $ store_context , AccountInterface $ current_user ) {
88+ public function __construct ($ plugin_id , $ plugin_definition , FieldDefinitionInterface $ field_definition , array $ settings , $ label , $ view_mode , array $ third_party_settings , EntityTypeManagerInterface $ entity_type_manager , NumberFormatterFactoryInterface $ number_formatter_factory , ChainPriceResolverInterface $ chain_price_resolver , CurrentStoreInterface $ current_store , AccountInterface $ current_user ) {
8989 parent ::__construct ($ plugin_id , $ plugin_definition , $ field_definition , $ settings , $ label , $ view_mode , $ third_party_settings , $ entity_type_manager , $ number_formatter_factory );
9090
9191 $ this ->chainPriceResolver = $ chain_price_resolver ;
92- $ this ->storeContext = $ store_context ;
92+ $ this ->currentStore = $ current_store ;
9393 $ this ->currencyStorage = $ entity_type_manager ->getStorage ('commerce_currency ' );
9494 $ this ->currentUser = $ current_user ;
9595 }
@@ -109,7 +109,7 @@ public static function create(ContainerInterface $container, array $configuratio
109109 $ container ->get ('entity_type.manager ' ),
110110 $ container ->get ('commerce_price.number_formatter_factory ' ),
111111 $ container ->get ('commerce_price.chain_price_resolver ' ),
112- $ container ->get ('commerce_store.store_context ' ),
112+ $ container ->get ('commerce_store.current_store ' ),
113113 $ container ->get ('current_user ' )
114114 );
115115 }
@@ -118,8 +118,7 @@ public static function create(ContainerInterface $container, array $configuratio
118118 * {@inheritdoc}
119119 */
120120 public function viewElements (FieldItemListInterface $ items , $ langcode ) {
121- $ store = $ this ->storeContext ->getStore ();
122- $ context = new Context ($ this ->currentUser , $ store );
121+ $ context = new Context ($ this ->currentUser , $ this ->currentStore ->getStore ());
123122 $ elements = [];
124123 /** @var \Drupal\commerce_price\Plugin\Field\FieldType\PriceItem $item */
125124 foreach ($ items as $ delta => $ item ) {
0 commit comments