protected function renderPanelElement($element, $cssClass)
    {
        $environment = $this->getEnvironment();

        $event = new GetPanelElementTemplateEvent($environment, $element);
        $environment->getEventDispatcher()->dispatch($event::NAME, $event);

        $template = $event->getTemplate();

        if (null === $template) {
            return '';
        }

        $template->set('rowClass', $cssClass);
        $element->render($template);

        return $template->parse();
    }