Decide whether to improve "WidgetProviderBase->build()":
/**
* {@inheritdoc}
*/
public function build() {
$buildContent = $this->buildContent();
if (is_array($buildContent)) {
// The result was a Drupal render array, we have to render it, otherwise
// it would be output in site context (template):
// @todo LATER think about how we could inject the response here and how
// to configure the expected response type (with or without theme...)
// @see https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21HtmlResponse.php/class/HtmlResponse/8.2.x
// Render in bare page without template around:
$attachments = \Drupal::service('html_response.attachments_processor');
$renderer = \Drupal::service('renderer');
$bareHtmlPageRenderer = new BareHtmlPageRenderer($renderer, $attachments);
// @see https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21BareHtmlPageRendererInterface.php/interface/BareHtmlPageRendererInterface/8.2.x
$response = $bareHtmlPageRenderer->renderBarePage($buildContent, $this->label(), 'markup');
// @todo This still contains CSS from theme. We have to decide what we really want here and how to control:
// ALTERNATIVE WITHOUT ANY WRAPPING HTML:
// $response = new HtmlResponse();
// // Render RenderArray as response:
// $response->setContent($buildContent);
return $response;
}
else {
return $buildContent;
}
// }
throw new WidgetValidationUnallowedReferrerException('You are not allowed to see this Widget!');
}
Discuss, whether to improve this.
Active
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.