Example #1
0
 /**
  * Render data
  *
  * @param UiComponentInterface $component
  * @param string $template
  * @return string
  * @throws \Exception
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function render(UiComponentInterface $component, $template = '')
 {
     $context = $component->getContext();
     $isComponent = $context->getRequestParam('componentJson');
     if ($isComponent) {
         $data = $this->structure->generate($component);
         return $this->encoder->encode($data);
     } else {
         $data = $component->getContext()->getDataSourceData($component);
         $data = reset($data);
         return $this->encoder->encode($data['config']['data']);
     }
 }
Example #2
0
 /**
  * Append layout configuration
  *
  * @return void
  */
 public function appendLayoutConfiguration()
 {
     $layoutConfiguration = $this->wrapContent(json_encode($this->structure->generate($this->component)));
     $this->template->append($layoutConfiguration);
 }