class SystemMessagesBlock in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/src/Plugin/Block/SystemMessagesBlock.php \Drupal\system\Plugin\Block\SystemMessagesBlock
- 9 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 DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\Core\Block\BlockBase implements BlockPluginInterface, ContextAwarePluginInterface, PluginWithFormsInterface, PreviewAwarePluginInterface, PreviewFallbackInterface uses BlockPluginTrait, ContextAwarePluginAssignmentTrait, ContextAwarePluginTrait
- class \Drupal\system\Plugin\Block\SystemMessagesBlock implements MessagesBlockPluginInterface
- class \Drupal\Core\Block\BlockBase implements BlockPluginInterface, ContextAwarePluginInterface, PluginWithFormsInterface, PreviewAwarePluginInterface, PreviewFallbackInterface uses BlockPluginTrait, ContextAwarePluginAssignmentTrait, ContextAwarePluginTrait
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
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;
}
}