_captchaData = $captchaData; } /** * Returns template path * * @return string */ public function getTemplate() { return $this->getIsAjax() ? '' : $this->_template; } /** * Returns URL to controller action which returns new captcha image * * @return string */ public function getRefreshUrl() { $store = $this->_storeManager->getStore(); return $store->getUrl('captcha/refresh', ['_secure' => $store->isCurrentlySecure()]); } /** * Renders captcha HTML (if required) * * @return string */ protected function _toHtml() { if ($this->getCaptchaModel()->isRequired()) { $this->getCaptchaModel()->generate(); return parent::_toHtml(); } return ''; } /** * Returns captcha model * * @return \Magento\Captcha\Model\CaptchaInterface */ public function getCaptchaModel() { return $this->_captchaData->getCaptcha($this->getFormId()); } }