protected function renderError(ElementInterface $element)
    {
        $messages = $element->getMessages();

        if (empty($messages)) {
            return null;
        }

        $errorPlugin = $this->getView()->plugin('sxb_form_errors');

        return $errorPlugin($element);
    }