Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractView.php
Go to the documentation of this file.
1 <?php
7 
16 {
20  protected $arrayUtils;
21 
27  public function __construct(
28  \Magento\Catalog\Block\Product\Context $context,
29  \Magento\Framework\Stdlib\ArrayUtils $arrayUtils,
30  array $data = []
31  ) {
32  $this->arrayUtils = $arrayUtils;
33  parent::__construct(
34  $context,
35  $data
36  );
37  }
38 
44  public function getProduct()
45  {
46  $product = parent::getProduct();
47  if ($product && $product->getTypeInstance()->getStoreFilter($product) === null) {
48  $product->getTypeInstance()->setStoreFilter($this->_storeManager->getStore(), $product);
49  }
50  return $product;
51  }
52 
61  public function decorateArray($array, $prefix = 'decorated_', $forceSetAll = false)
62  {
63  return $this->arrayUtils->decorateArray($array, $prefix, $forceSetAll);
64  }
65 }
$prefix
Definition: name.phtml:25
__construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, array $data=[])
decorateArray($array, $prefix='decorated_', $forceSetAll=false)