Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigurablePrice.php
Go to the documentation of this file.
1 <?php
7 
12 
17 {
18  const CODE_GROUP_PRICE = 'container_price';
19 
23  private static $advancedPricingButton = 'advanced_pricing_button';
24 
28  private $locator;
29 
33  public function __construct(
34  LocatorInterface $locator
35  ) {
36  $this->locator = $locator;
37  }
38 
42  public function modifyData(array $data)
43  {
44  return $data;
45  }
46 
50  public function modifyMeta(array $meta)
51  {
53  ?: $this->getGroupCodeByField($meta, self::CODE_GROUP_PRICE);
54 
55  if ($groupCode && !empty($meta[$groupCode]['children'][self::CODE_GROUP_PRICE])) {
56  if (!empty($meta[$groupCode]['children'][self::CODE_GROUP_PRICE])) {
57  $meta[$groupCode]['children'][self::CODE_GROUP_PRICE] = array_replace_recursive(
58  $meta[$groupCode]['children'][self::CODE_GROUP_PRICE],
59  [
60  'children' => [
62  'arguments' => [
63  'data' => [
64  'config' => [
65  'component' => 'Magento_ConfigurableProduct/js/' .
66  'components/price-configurable'
67  ],
68  ],
69  ],
70  ],
71  ],
72  ]
73  );
74  }
75  if (!empty(
76  $meta[$groupCode]['children'][self::CODE_GROUP_PRICE]['children'][self::$advancedPricingButton]
77  )) {
78  $productTypeId = $this->locator->getProduct()->getTypeId();
79  $visibilityConfig = ($productTypeId === ConfigurableType::TYPE_CODE)
80  ? ['visible' => 0, 'disabled' => 1]
81  : [
82  'imports' => [
83  'visible' => 'ns = ${ $.ns }, index = '
85  ]
86  ];
87  $config = $visibilityConfig;
88  $config['componentType'] = 'container';
89  $meta[$groupCode]['children'][self::CODE_GROUP_PRICE] = array_replace_recursive(
90  $meta[$groupCode]['children'][self::CODE_GROUP_PRICE],
91  [
92  'children' => [
93  self::$advancedPricingButton => [
94  'arguments' => [
95  'data' => [
96  'config' => $config,
97  ],
98  ],
99  ],
100  ],
101  ]
102  );
103  }
104  }
105 
106  return $meta;
107  }
108 }
$config
Definition: fraud_order.php:17