/
StockData.php
73 lines (65 loc) · 1.96 KB
/
StockData.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Bundle\Ui\DataProvider\Product\Form\Modifier;
use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Bundle\Model\Product\Type;
/**
* Class StockData hides unnecessary fields in Advanced Inventory Modal
*/
class StockData extends AbstractModifier
{
/**
* @var LocatorInterface
*/
protected $locator;
/**
* @param LocatorInterface $locator
*/
public function __construct(LocatorInterface $locator)
{
$this->locator = $locator;
}
/**
* {@inheritdoc}
*/
public function modifyData(array $data)
{
return $data;
}
/**
* {@inheritdoc}
*/
public function modifyMeta(array $meta)
{
if ($this->locator->getProduct()->getTypeId() === Type::TYPE_CODE) {
$config['arguments']['data']['config'] = [
'visible' => 0,
'imports' => [
'visible' => null,
],
];
$meta['advanced_inventory_modal'] = [
'children' => [
'stock_data' => [
'children' => [
'qty' => $config,
'container_min_qty' => $config,
'container_min_sale_qty' => $config,
'container_max_sale_qty' => $config,
'is_qty_decimal' => $config,
'is_decimal_divided' => $config,
'container_backorders' => $config,
'container_deferred_stock_update' => $config,
'container_notify_stock_qty' => $config,
],
],
],
];
}
return $meta;
}
}