class TestAttributesBlock
Same name and namespace in other branches
- 11.x core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/TestAttributesBlock.php \Drupal\layout_builder_test\Plugin\Block\TestAttributesBlock
- 10 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/TestAttributesBlock.php \Drupal\layout_builder_test\Plugin\Block\TestAttributesBlock
Provides a 'TestAttributes' block.
Plugin annotation
@Block(
id = "layout_builder_test_test_attributes",
admin_label = @Translation("Test Attributes"),
category = @Translation("Test")
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \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\layout_builder_test\Plugin\Block\TestAttributesBlock 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\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of TestAttributesBlock
File
-
core/
modules/ layout_builder/ tests/ modules/ layout_builder_test/ src/ Plugin/ Block/ TestAttributesBlock.php, line 17
Namespace
Drupal\layout_builder_test\Plugin\BlockView source
class TestAttributesBlock extends BlockBase {
/**
* {@inheritdoc}
*/
public function blockForm($form, FormStateInterface $form_state) {
return $form;
}
/**
* {@inheritdoc}
*/
public function build() {
$build = [
'#attributes' => [
'class' => [
'attribute-test-class',
],
'custom-attribute' => 'test',
],
'#markup' => $this->t('Example block providing its own attributes.'),
'#contextual_links' => [
'layout_builder_test' => [
'route_parameters' => [],
],
],
];
return $build;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.