function hook_workbench_block in Workbench 8
Same name and namespace in other branches
- 7 workbench.api.php \hook_workbench_block()
Return Workbench status information in a block.
To reduce clutter, modules are encouraged to use this hook to provide debugging and other relevant information.
Return value
array An array of message strings to print. The preferred format is a one line string in the format Title: <em>Message</em>.
See also
WorkbenchBlock::build()
1 invocation of hook_workbench_block()
- WorkbenchBlock::build in src/
Plugin/ Block/ WorkbenchBlock.php - Builds and returns the renderable array for this block plugin.
File
- ./
workbench.api.php, line 78 - API documentation file for Workbench.
Code
function hook_workbench_block() {
// Add editing information to this page (if it's a node).
if ($node = \Drupal::routeMatch()
->getParameter('node')) {
if ($node->entityTypeId == 'node' && $node
->access('update')) {
return [
t('My Module: <em>You may edit this content.</em>'),
];
}
else {
return [
t('My Module: <em>You may not edit this content.</em>'),
];
}
}
}