Bolt\Asset\Widget\Queue::render PHP Method

render() public method

Render a location's widget.
public render ( string $location, string $zone = Zone::FRONTEND, string $wrapperTemplate = 'widgetwrapper.twig' ) : string | null
$location string Location (e.g. 'dashboard_aside_top')
$zone string Either Zone::FRONTEND or Zone::BACKEND
$wrapperTemplate string Template file for wrapper
return string | null
    public function render($location, $zone = Zone::FRONTEND, $wrapperTemplate = 'widgetwrapper.twig')
    {
        $widgets = [];
        /** @var WidgetAssetInterface $widget */
        foreach ($this->sort($this->queue) as $widget) {
            if ($widget->getZone() !== $zone || $widget->getLocation() !== $location) {
                continue;
            }
            $html = $widget->isDeferred() ? null : $this->getHtml($widget);
            $widgets[] = ['object' => $widget, 'html' => $html];
        }
        if (empty($widgets)) {
            return null;
        }
        return $this->render->render($wrapperTemplate, ['location' => $location, 'widgets' => $widgets]);
    }