/** * {@inheritdoc} */ public function getDataSourceData(UiComponentInterface $component) { $dataSource = $component->getDataSourceData(); $this->prepareDataSource($dataSource, $component); $dataProviderConfig = $this->getDataProvider()->getConfigData(); return [$this->getDataProvider()->getName() => ['type' => 'dataSource', 'name' => $this->getDataProvider()->getName(), 'dataScope' => $this->getNamespace(), 'config' => array_replace_recursive(array_merge($dataSource, $dataProviderConfig), ['params' => ['namespace' => $this->getNamespace()]])]]; }
/** * Render data * * @param UiComponentInterface $component * @param string $template * @return string * @throws \Exception */ public function render(UiComponentInterface $component, $template = '') { $data = $component->getDataSourceData(); $data = reset($data); return json_encode($data['config']['data']); }