class CaptchaFontPreviewController in CAPTCHA 8
Controller which generates the image from defined settings.
Hierarchy
- class \Drupal\image_captcha\Controller\CaptchaFontPreviewController implements ContainerInjectionInterface
Expanded class hierarchy of CaptchaFontPreviewController
File
- image_captcha/
src/ Controller/ CaptchaFontPreviewController.php, line 14
Namespace
Drupal\image_captcha\ControllerView source
class CaptchaFontPreviewController implements ContainerInjectionInterface {
/**
* Image Captcha config storage.
*
* @var \Drupal\Core\Config\ImmutableConfig
*/
protected $config;
/**
* Kill Switch for page caching.
*
* @var \Drupal\Core\PageCache\ResponsePolicy\KillSwitch
*/
protected $killSwitch;
/**
* {@inheritdoc}
*/
public function __construct(ImmutableConfig $config, KillSwitch $kill_switch) {
$this->config = $config;
$this->killSwitch = $kill_switch;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('config.factory')
->get('image_captcha.settings'), $container
->get('page_cache_kill_switch'));
}
/**
* Main method that throw ImageResponse object to generate image.
*
* @return \Drupal\image_captcha\StreamedResponse\CaptchaFontPreviewStreamedResponse
* Make a CaptchaImageResponse with the correct configuration and return it.
*/
public function getFont($token) {
$this->killSwitch
->trigger();
return new CaptchaFontPreviewStreamedResponse($this->config, $token);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CaptchaFontPreviewController:: |
protected | property | Image Captcha config storage. | |
CaptchaFontPreviewController:: |
protected | property | Kill Switch for page caching. | |
CaptchaFontPreviewController:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
CaptchaFontPreviewController:: |
public | function | Main method that throw ImageResponse object to generate image. | |
CaptchaFontPreviewController:: |
public | function |