config = $config; } /** * @param \Magento\Framework\Data\Form\Element\AbstractElement $element * @return string */ protected function _getElementHtml(AbstractElement $element) { return $this->getGeoIpRestrictionsNotice() . parent::_getElementHtml($element); } /** * @param $withContainer * @return \Magento\Framework\Phrase|string */ public function getGeoIpRestrictionsNotice($withContainer = true) { $message = ''; switch (true) { case ! $this->config->isModuleEnabled(): $message = __( 'Geo Targeting is disabled. ' . 'For more accurate geolocation detection, please enable and configure the IP Geolocation Lookup extension following the guide.', 'https://plumrocket.com/docs/magento-ip-geolocation-lookup/v2/configuration' ); break; case ! $this->config->getEnableMethodsNumber(): $message = __( 'Please enable at least one IP Geolocation Lookup database to use Geo Targeting. ' . 'Click here for configuration guide.', 'https://plumrocket.com/docs/magento-ip-geolocation-lookup/v2/configuration' ); break; } return (bool) $withContainer && ! empty($message) ? $this->getPreparedNoticeHtml($message) : $message; } /** * @param $message * @return string */ public function getPreparedNoticeHtml($message): string { $style = 'style="margin: 25px 5px;color: #eb5202;background: none;font-size:14px"'; return "
$message
"; } }