/** * {@inheritdoc} */ public function build() { if (isset($this->configuration['layout']) && !empty($this->configuration['blocks'])) { $renderer = new LayoutRendererBlockAndContext(\Drupal::service('context.handler'), \Drupal::currentUser()); $build = $renderer->build($this->getLayout(), $this); $build['#attached']['library'][] = 'widget/css'; // Add JS that builds tabs of the content if tabbed layout is selected. if ($this->configuration['layout'] == 'widget_main_with_quicktabs') { $build['#attached']['library'][] = 'widget/tabs'; } return $build; } return array(); }
/** * {@inheritdoc} */ public function build() { if ($this->getLayoutId() && ($layout = $this->getLayout())) { $renderer = new LayoutRendererBlockAndContext($this->contextHandler, $this->account); $output = $renderer->build($layout, $this); return $output; } return array(); }