setError(false); $widgetInstance = $this->_initWidgetInstance(); $result = $widgetInstance->validate(); if ($result !== true && is_string($result)) { $this->messageManager->addError($result); $this->_view->getLayout()->initMessages(); $response->setError(true); $response->setHtmlMessage($this->_view->getLayout()->getMessagesBlock()->getGroupedHtml()); } $response = $response->toJson(); $this->_translateInline->processResponseBody($response); $this->_response->representJson($response); } }