btcPayService = $btcPayService;
$this->helper = $helper;
}
/**
* Render form element as HTML
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$html = $this->getConnectionStatusPerStore();
$r = '
| ' . $html . ' | |
';
return $r;
}
public function getErrorHtml(int $magentoStoreId): string
{
$lines = $this->helper->getInstallationErrors($magentoStoreId, false);
if (count($lines) > 0) {
$r = '';
foreach ($lines as $line) {
$r .= '- ' . $line . '
';
}
$r .= '
';
} else {
$r = 'OK';
}
return $r;
}
public function getConnectionStatusPerStore()
{
$html = '
| ' . __('Store') . ' |
' . __('Feedback') . ' |
';
$magentoStores = $this->helper->getAllMagentoStoreViews();
foreach ($magentoStores as $magentoStore) {
$storeId = (int)$magentoStore->getId();
$html = $html . '
| ' . $magentoStore->getName() . ' |
' . $this->getErrorHtml($storeId) . ' |
';
}
return $html . '
';
}
}