class AutowireBlock
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/autowire_test/src/Plugin/Block/AutowireBlock.php \Drupal\autowire_test\Plugin\Block\AutowireBlock
Provides a block that can be autowired.
Attributes
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\DependencyInjection\AutowiredInstanceTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
- class \Drupal\Core\Block\BlockBase implements \Drupal\Core\Block\BlockPluginInterface, \Drupal\Core\Plugin\PluginWithFormsInterface, \Drupal\Core\Plugin\PreviewAwarePluginInterface, \Drupal\Core\Render\PreviewFallbackInterface, \Drupal\Core\Plugin\ContextAwarePluginInterface uses \Drupal\Core\Block\BlockPluginTrait, \Drupal\Core\Plugin\ContextAwarePluginTrait, \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\autowire_test\Plugin\Block\AutowireBlock implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface extends \Drupal\Core\Block\BlockBase
- class \Drupal\Core\Block\BlockBase implements \Drupal\Core\Block\BlockPluginInterface, \Drupal\Core\Plugin\PluginWithFormsInterface, \Drupal\Core\Plugin\PreviewAwarePluginInterface, \Drupal\Core\Render\PreviewFallbackInterface, \Drupal\Core\Plugin\ContextAwarePluginInterface uses \Drupal\Core\Block\BlockPluginTrait, \Drupal\Core\Plugin\ContextAwarePluginTrait, \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\DependencyInjection\AutowiredInstanceTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of AutowireBlock
1 file declares its use of AutowireBlock
- AutowireBlockTest.php in core/
tests/ Drupal/ KernelTests/ Core/ Block/ AutowireBlockTest.php
File
-
core/
modules/ system/ tests/ modules/ autowire_test/ src/ Plugin/ Block/ AutowireBlock.php, line 17
Namespace
Drupal\autowire_test\Plugin\BlockView source
class AutowireBlock extends BlockBase implements ContainerFactoryPluginInterface {
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, #[Autowire(service: 'lock')] protected LockBackendInterface $lock) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
/**
* {@inheritdoc}
*/
public function build() {
return [];
}
/**
* Gets the lock service.
*/
public function getLock() : LockBackendInterface {
return $this->lock;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.