Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DataSource.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Ui\Component;
7 
11 
17 {
18  const NAME = 'dataSource';
19 
23  protected $dataProvider;
24 
33  public function __construct(
36  array $components = [],
37  array $data = []
38  ) {
39  $this->dataProvider = $dataProvider;
40  $context->setDataProvider($dataProvider);
41  parent::__construct($context, $components, $data);
42  }
43 
49  public function getComponentName()
50  {
51  return static::NAME;
52  }
53 
59  public function prepare()
60  {
61  $jsConfig = $this->getJsConfig($this);
62  unset($jsConfig['extends']);
63  $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
64  }
65 
69  public function getDataProvider()
70  {
71  return $this->dataProvider;
72  }
73 }
getJsConfig(UiComponentInterface $component)
__construct(ContextInterface $context, DataProviderInterface $dataProvider, array $components=[], array $data=[])
Definition: DataSource.php:33