public function onPreRender($param)
{
parent::onPreRender($param);
if (!self::checkRequirements()) {
throw new TConfigurationException('captcha_imagettftext_required');
}
if (!$this->getViewState('TokenGenerated', 0)) {
$manager = $this->getApplication()->getAssetManager();
$manager->publishFilePath($this->getFontFile());
$url = $manager->publishFilePath($this->getCaptchaScriptFile());
$url .= '?options=' . urlencode($this->getTokenImageOptions());
$this->setImageUrl($url);
$this->setViewState('TokenGenerated', time());
}
}