6
6
use Drupal \commerce \PurchasableEntityInterface ;
7
7
use Drupal \commerce_price \NumberFormatterFactoryInterface ;
8
8
use Drupal \commerce_price \Resolver \ChainPriceResolverInterface ;
9
- use Drupal \commerce_store \StoreContextInterface ;
9
+ use Drupal \commerce_store \CurrentStoreInterface ;
10
10
use Drupal \Core \Cache \Cache ;
11
11
use Drupal \Core \Entity \EntityTypeManagerInterface ;
12
12
use Drupal \Core \Field \FieldDefinitionInterface ;
@@ -51,11 +51,11 @@ class PriceCalculatedFormatter extends PriceDefaultFormatter implements Containe
51
51
protected $ currentUser ;
52
52
53
53
/**
54
- * The store context .
54
+ * The current store .
55
55
*
56
- * @var \Drupal\commerce_store\StoreContextInterface
56
+ * @var \Drupal\commerce_store\CurrentStoreInterface
57
57
*/
58
- protected $ storeContext ;
58
+ protected $ currentStore ;
59
59
60
60
/**
61
61
* Constructs a new PriceCalculatedFormatter object.
@@ -80,16 +80,16 @@ class PriceCalculatedFormatter extends PriceDefaultFormatter implements Containe
80
80
* The number formatter factory.
81
81
* @param \Drupal\commerce_price\Resolver\ChainPriceResolverInterface $chain_price_resolver
82
82
* 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 .
85
85
* @param \Drupal\Core\Session\AccountInterface $current_user
86
86
* The current user.
87
87
*/
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 ) {
89
89
parent ::__construct ($ plugin_id , $ plugin_definition , $ field_definition , $ settings , $ label , $ view_mode , $ third_party_settings , $ entity_type_manager , $ number_formatter_factory );
90
90
91
91
$ this ->chainPriceResolver = $ chain_price_resolver ;
92
- $ this ->storeContext = $ store_context ;
92
+ $ this ->currentStore = $ current_store ;
93
93
$ this ->currencyStorage = $ entity_type_manager ->getStorage ('commerce_currency ' );
94
94
$ this ->currentUser = $ current_user ;
95
95
}
@@ -109,7 +109,7 @@ public static function create(ContainerInterface $container, array $configuratio
109
109
$ container ->get ('entity_type.manager ' ),
110
110
$ container ->get ('commerce_price.number_formatter_factory ' ),
111
111
$ container ->get ('commerce_price.chain_price_resolver ' ),
112
- $ container ->get ('commerce_store.store_context ' ),
112
+ $ container ->get ('commerce_store.current_store ' ),
113
113
$ container ->get ('current_user ' )
114
114
);
115
115
}
@@ -118,8 +118,7 @@ public static function create(ContainerInterface $container, array $configuratio
118
118
* {@inheritdoc}
119
119
*/
120
120
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 ());
123
122
$ elements = [];
124
123
/** @var \Drupal\commerce_price\Plugin\Field\FieldType\PriceItem $item */
125
124
foreach ($ items as $ delta => $ item ) {
0 commit comments