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-catalog
Ui
DataProvider
Product
Form
NewCategoryDataProvider.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Catalog\Ui\DataProvider\Product\Form
;
7
8
use
Magento\Ui\DataProvider\AbstractDataProvider
;
9
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
10
use
Magento\Framework\UrlInterface
;
11
18
class
NewCategoryDataProvider
extends
AbstractDataProvider
19
{
24
protected
$urlBuilder
;
25
35
public
function
__construct
(
36
$name
,
37
$primaryFieldName
,
38
$requestFieldName
,
39
CollectionFactory $collectionFactory,
40
UrlInterface
$urlBuilder
,
41
array
$meta
= [],
42
array
$data
= []
43
) {
44
parent::__construct(
$name
,
$primaryFieldName
,
$requestFieldName
,
$meta
,
$data
);
45
$this->collection = $collectionFactory->create();
46
$this->urlBuilder =
$urlBuilder
;
47
}
48
53
public
function
getData
()
54
{
55
$this->data = array_replace_recursive(
56
$this->data,
57
[
58
'config'
=> [
59
'data'
=> [
60
'is_active'
=> 1,
61
'include_in_menu'
=> 1,
62
'return_session_messages_only'
=> 1,
63
'use_config'
=> [
'available_sort_by'
,
'default_sort_by'
]
64
]
65
]
66
]
67
);
68
69
return
$this->data
;
70
}
71
76
public
function
getMeta
()
77
{
78
$this->meta = [
79
'data'
=> [
80
'children'
=> [
81
'parent'
=> [
82
'notice'
=> $this->
getNotice
(),
83
]
84
]
85
]
86
];
87
88
return
parent::getMeta();
89
}
90
97
protected
function
getNotice
()
98
{
99
return
__
(
100
'If there are no custom parent categories, please use the default parent category.'
101
.
' You can reassign the category at any time in'
102
.
' <a href="%1" target="_blank">Products > Categories</a>.'
,
103
$this->urlBuilder->getUrl(
'catalog/category'
)
104
);
105
}
106
}
Magento\Catalog\Ui\DataProvider\Product\Form
Magento\Catalog\Ui\DataProvider\Product\Form\NewCategoryDataProvider\__construct
__construct( $name, $primaryFieldName, $requestFieldName, CollectionFactory $collectionFactory, UrlInterface $urlBuilder, array $meta=[], array $data=[])
Definition:
NewCategoryDataProvider.php:35
Magento\Ui\DataProvider\AbstractDataProvider\$meta
$meta
Definition:
AbstractDataProvider.php:41
Magento\Catalog\Ui\DataProvider\Product\Form\NewCategoryDataProvider\$urlBuilder
$urlBuilder
Definition:
NewCategoryDataProvider.php:24
__
__()
Definition:
__.php:13
Magento\Framework\UrlInterface
Definition:
UrlInterface.php:12
Magento\Ui\DataProvider\AbstractDataProvider\$primaryFieldName
$primaryFieldName
Definition:
AbstractDataProvider.php:29
Magento\Catalog\Ui\DataProvider\Product\Form\NewCategoryDataProvider
Definition:
NewCategoryDataProvider.php:18
Magento\Ui\DataProvider\AbstractDataProvider\$name
$name
Definition:
AbstractDataProvider.php:22
Magento\Ui\DataProvider\AbstractDataProvider\$data
$data
Definition:
AbstractDataProvider.php:48
Magento\Catalog\Ui\DataProvider\Product\Form\NewCategoryDataProvider\getNotice
getNotice()
Definition:
NewCategoryDataProvider.php:97
Magento\Catalog\Ui\DataProvider\Product\Form\NewCategoryDataProvider\getMeta
getMeta()
Definition:
NewCategoryDataProvider.php:76
Magento\Catalog\Ui\DataProvider\Product\Form\NewCategoryDataProvider\getData
getData()
Definition:
NewCategoryDataProvider.php:53
Magento\Ui\DataProvider\AbstractDataProvider\$requestFieldName
$requestFieldName
Definition:
AbstractDataProvider.php:36
Magento\Ui\DataProvider\AbstractDataProvider
Definition:
AbstractDataProvider.php:15