ContextBlock.php in Core Context 8
File
tests/modules/core_context_test/src/Plugin/Block/ContextBlock.php
View source
<?php
namespace Drupal\core_context_test\Plugin\Block;
use Drupal\Core\Block\BlockBase;
class ContextBlock extends BlockBase {
public function build() {
return [
'#markup' => $this
->t('The context value is %value, brought to you by the letter %letter.', [
'%value' => $this
->getContextValue('value'),
'%letter' => $this
->getContextValue('letter'),
]),
];
}
}
Classes
Name |
Description |
ContextBlock |
Plugin annotation
@Block(
id = "context_block",
admin_label = @Translation("Context block"),
context_definitions = {
"value" = @ContextDefinition("any"),
"letter" = @ContextDefinition("string"),
},
) |