getVersion(), '2.4.0', '<')) { parent::__construct($context, $data); } else { parent::__construct($context, $data, $objectManager->get(SecureHtmlRenderer::class)); } $this->wellKnownFileManager = $wellKnownFileManager; $this->logger = $logger; } /** * @param AbstractElement $element * @return string */ protected function _getElementHtml(AbstractElement $element): string { try { return $this->renderPre( $this->wellKnownFileManager->getContent() ); } catch (\Exception $e) { $this->logger->error('[Plumrocket_GlobalPrivacyControl] Unable to read the .well-known file content: ' . $e->getMessage(), ['exception' => $e]); return $this->renderNotice( __('Unable to load file content. Please check the logs for more details.') ); } } /** * Render formatted
block with code.
*
* @param string $content
* @return string
*/
private function renderPre(string $content): string
{
return '' . $content . '
';
}
/**
* Render styled error notice.
*
* @param \Magento\Framework\Phrase|string $message
* @return string
*/
private function renderNotice($message): string
{
return <<
{$message}
HTML;
}
}