class SystemMessagesBlock
Same name in other branches
- 9 core/modules/system/src/Plugin/Block/SystemMessagesBlock.php \Drupal\system\Plugin\Block\SystemMessagesBlock
- 10 core/modules/system/src/Plugin/Block/SystemMessagesBlock.php \Drupal\system\Plugin\Block\SystemMessagesBlock
- 11.x core/modules/system/src/Plugin/Block/SystemMessagesBlock.php \Drupal\system\Plugin\Block\SystemMessagesBlock
Provides a block to display the messages.
Plugin annotation
@Block(
id = "system_messages_block",
admin_label = @Translation("Messages")
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Component\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\ContextAwarePluginInterface
- class \Drupal\Core\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\ContextAwarePluginBase implements \Drupal\Core\Plugin\ContextAwarePluginInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\TypedData\TypedDataTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Block\BlockBase extends \Drupal\Core\Plugin\ContextAwarePluginBase implements \Drupal\Core\Block\BlockPluginInterface, \Drupal\Core\Plugin\PluginWithFormsInterface, \Drupal\Core\Render\PreviewFallbackInterface uses \Drupal\Core\Block\BlockPluginTrait, \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait
- class \Drupal\system\Plugin\Block\SystemMessagesBlock extends \Drupal\Core\Block\BlockBase implements \Drupal\Core\Block\MessagesBlockPluginInterface
- class \Drupal\Core\Block\BlockBase extends \Drupal\Core\Plugin\ContextAwarePluginBase implements \Drupal\Core\Block\BlockPluginInterface, \Drupal\Core\Plugin\PluginWithFormsInterface, \Drupal\Core\Render\PreviewFallbackInterface uses \Drupal\Core\Block\BlockPluginTrait, \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait
- class \Drupal\Core\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\ContextAwarePluginBase implements \Drupal\Core\Plugin\ContextAwarePluginInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\TypedData\TypedDataTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Component\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\ContextAwarePluginInterface
Expanded class hierarchy of SystemMessagesBlock
See also
@see \Drupal\Core\Messenger\MessengerInterface
File
-
core/
modules/ system/ src/ Plugin/ Block/ SystemMessagesBlock.php, line 19
Namespace
Drupal\system\Plugin\BlockView source
class SystemMessagesBlock extends BlockBase implements MessagesBlockPluginInterface {
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [
'label_display' => FALSE,
];
}
/**
* {@inheritdoc}
*/
public function build() {
return [
'#type' => 'status_messages',
'#include_fallback' => TRUE,
];
}
/**
* {@inheritdoc}
*/
public function getCacheMaxAge() {
// The messages are session-specific and hence aren't cacheable, but the
// block itself *is* cacheable because it uses a #lazy_builder callback and
// hence the block has a globally cacheable render array.
return Cache::PERMANENT;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
SystemMessagesBlock::build | public | function | |
SystemMessagesBlock::defaultConfiguration | public | function | |
SystemMessagesBlock::getCacheMaxAge | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.