Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddColumnQuantityPerSource.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
14 
19 {
23  private $isSingleSourceMode;
24 
28  public function __construct(
29  IsSingleSourceModeInterface $isSingleSourceMode
30  ) {
31  $this->isSingleSourceMode = $isSingleSourceMode;
32  }
33 
43  public function afterGetMeta(GroupedProductDataProvider $subject, array $result): array
44  {
45  if (!$this->isSingleSourceMode->execute()) {
46  $result = array_replace_recursive($result, [
47  'product_columns' => [
48  'children' => [
49  'quantity_per_source' => $this->getQuantityPerSourceMeta(),
50  'qty' => [
51  'arguments' => null,
52  ],
53  ],
54  ],
55  ]);
56  }
57 
58  return $result;
59  }
60 
66  private function getQuantityPerSourceMeta(): array
67  {
68  $jsComponent = 'Magento_InventoryGroupedProductAdminUi/js/form/element/grid-column-quantity-per-source';
69 
70  return [
71  'arguments' => [
72  'data' => [
73  'config' => [
74  'filter' => false,
75  'sortable' => false,
76  'label' => __('Quantity per Source'),
77  'dataType' => Text::NAME,
78  'componentType' => Column::NAME,
79  'component' => $jsComponent,
80  ]
81  ],
82  ],
83  ];
84  }
85 }
__()
Definition: __.php:13