_devToolHelper = $context->getAssetordererHelper(); $this->_config = $context->getConfig(); $this->_urlApp=$context->getUrlFactory()->create(); parent::__construct($context); } /** * Function for getting event details * @return array */ public function getEventDetails() { return $this->_devToolHelper->getEventDetails(); } /** * Function for getting current url * @return string */ public function getCurrentUrl(){ return $this->_urlApp->getCurrentUrl(); } /** * Function for getting controller url for given router path * @param string $routePath * @return string */ public function getControllerUrl($routePath){ return $this->_urlApp->getUrl($routePath); } /** * Function for getting current url * @param string $path * @return string */ public function getConfigValue($path){ return $this->_config->getCurrentStoreConfigValue($path); } /** * Function canShowAssetorderer * @return bool */ public function canShowAssetorderer(){ $isEnabled=$this->getConfigValue('assetorderer/module/is_enabled'); if($isEnabled) { $allowedIps=$this->getConfigValue('assetorderer/module/allowed_ip'); if(is_null($allowedIps)){ return true; } else { $remoteIp=$_SERVER['REMOTE_ADDR']; if (strpos($allowedIps,$remoteIp) !== false) { return true; } } } return false; } }