Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-inventory-catalog-admin-ui
Ui
Component
AssignSources
Record.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventoryCatalogAdminUi\Ui\Component\AssignSources
;
9
10
use
Magento\Framework\View\Element\UiComponent\ContextInterface
;
11
use
Magento\Framework\View\Element\UiComponentInterface
;
12
use
Magento\InventoryApi\Api\Data\StockInterface
;
13
use
Magento\InventoryCatalogApi\Api\DefaultStockProviderInterface
;
14
use
Magento\Ui\Component\Container
;
15
16
class
Record
extends
Container
17
{
21
private
$defaultStockProvider;
22
29
public
function
__construct
(
30
ContextInterface
$context
,
31
DefaultStockProviderInterface
$defaultStockProvider,
32
array
$components
= [],
33
array
$data
= []
34
) {
35
parent::__construct(
$context
,
$components
,
$data
);
36
$this->defaultStockProvider = $defaultStockProvider;
37
}
38
42
public
function
prepare
()
43
{
44
parent::prepare();
45
46
// Disable assign sources if stock is default
47
$stockId = (int) $this->context->getRequestParam(
StockInterface::STOCK_ID
);
48
if
($stockId === $this->defaultStockProvider->getId()) {
49
$deleteConfig = $this->components[
'actionDelete'
]->getData(
'config'
);
50
$deleteConfig[
'disabled'
] =
true
;
51
$deleteConfig[
'notice'
] =
__
(
'Disabled for default stock'
);
52
$this->components[
'actionDelete'
]->setData(
'config'
, $deleteConfig);
53
}
54
}
55
}
Magento\Framework\View\Element\UiComponent\ContextInterface
Definition:
ContextInterface.php:17
Magento\InventoryCatalogAdminUi\Ui\Component\AssignSources
Definition:
Button.php:8
Magento\Framework\View\Element\UiComponentInterface
Definition:
UiComponentInterface.php:16
Magento\InventoryCatalogAdminUi\Ui\Component\AssignSources\Record
Definition:
Record.php:16
Magento\InventoryApi\Api\Data\StockInterface\STOCK_ID
const STOCK_ID
Definition:
StockInterface.php:22
Magento\InventoryApi\Api\Data\StockInterface
Definition:
StockInterface.php:17
Magento\InventoryCatalogAdminUi\Ui\Component\AssignSources\Record\__construct
__construct(ContextInterface $context, DefaultStockProviderInterface $defaultStockProvider, array $components=[], array $data=[])
Definition:
Record.php:29
__
__()
Definition:
__.php:13
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Ui\Component\AbstractComponent\$context
$context
Definition:
AbstractComponent.php:31
Magento\Ui\Component\Container
Definition:
Container.php:12
Magento\InventoryCatalogApi\Api\DefaultStockProviderInterface
Definition:
DefaultStockProviderInterface.php:15
Magento\Ui\Component\AbstractComponent\$components
$components
Definition:
AbstractComponent.php:36
Magento\InventoryCatalogAdminUi\Ui\Component\AssignSources\Record\prepare
prepare()
Definition:
Record.php:42