Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ModeSwitcherConfiguration.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 
18 {
19  const XML_PATH_PRICE_DIMENSIONS_MODE = 'indexer/catalog_product_price/dimensions_mode';
20 
26  private $configWriter;
27 
33  private $cacheTypeList;
34 
38  private $indexer;
39 
45  public function __construct(
46  ConfigInterface $configWriter,
47  TypeListInterface $cacheTypeList,
48  Indexer $indexer
49  ) {
50  $this->configWriter = $configWriter;
51  $this->cacheTypeList = $cacheTypeList;
52  $this->indexer = $indexer;
53  }
54 
62  public function saveMode(string $mode)
63  {
64  //Change config options
65  $this->configWriter->saveConfig(self::XML_PATH_PRICE_DIMENSIONS_MODE, $mode);
66  $this->cacheTypeList->cleanType('config');
67  $this->indexer->load(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID);
68  $this->indexer->invalidate();
69  }
70 }
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15
__construct(ConfigInterface $configWriter, TypeListInterface $cacheTypeList, Indexer $indexer)