Autowiring.php
Namespace
Drupal\image_test\Plugin\ImageToolkit\Operation\testFile
-
core/
modules/ system/ tests/ modules/ image_test/ src/ Plugin/ ImageToolkit/ Operation/ test/ Autowiring.php
View source
<?php
declare (strict_types=1);
namespace Drupal\image_test\Plugin\ImageToolkit\Operation\test;
use Drupal\Core\ImageToolkit\Attribute\ImageToolkitOperation;
use Drupal\Core\State\StateInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
/**
* Builds an image toolkit operation.
*/
class Autowiring extends OperationBase {
public function __construct(array $configuration, string $plugin_id, array $plugin_definition, #[Autowire(service: 'logger.channel.image')] LoggerInterface $logger, #[Autowire(service: 'messenger')] protected $messenger, private readonly StateInterface $state) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $logger);
}
/**
* {@inheritdoc}
*/
public function execute(array $arguments) {
$this->state
->set('image_test.autowiring_operation', 'foo');
return TRUE;
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| Autowiring | Builds an image toolkit operation. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.