Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NewCategoryDataProvider.php
Go to the documentation of this file.
1 <?php
7 
9 use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
11 
19 {
24  protected $urlBuilder;
25 
35  public function __construct(
36  $name,
39  CollectionFactory $collectionFactory,
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 &gt; Categories</a>.',
103  $this->urlBuilder->getUrl('catalog/category')
104  );
105  }
106 }
__construct( $name, $primaryFieldName, $requestFieldName, CollectionFactory $collectionFactory, UrlInterface $urlBuilder, array $meta=[], array $data=[])
__()
Definition: __.php:13