public function BusinessRulesDebugBlock::build in Business Rules 2.x
Same name and namespace in other branches
- 8 src/Plugin/Block/BusinessRulesDebugBlock.php \Drupal\business_rules\Plugin\Block\BusinessRulesDebugBlock::build()
Builds and returns the renderable array for this block plugin.
If a block should not be rendered because it has no content, then this method must also ensure to return no content: it must then only return an empty array, or an empty array with #cache set (with cacheability metadata indicating the circumstances for it being empty).
Return value
array A renderable array representing the content of the block.
Overrides BlockPluginInterface::build
See also
\Drupal\block\BlockViewBuilder
File
- src/
Plugin/ Block/ BusinessRulesDebugBlock.php, line 72
Class
- BusinessRulesDebugBlock
- Class BusinessRulesDebugBlock.
Namespace
Drupal\business_rules\Plugin\BlockCode
public function build() {
$output = [];
if ($this->config
->get('debug_screen')) {
$session_id = session_id();
$debug = $this->keyvalue
->get($session_id);
$this->keyvalue
->set($session_id, NULL);
if ($debug && count($debug)) {
$output['#attached']['library'][] = 'business_rules/style';
$output['#attached']['library'][] = 'dbug/dbug';
$output['business_rules_debug'] = [
'#type' => 'details',
'#title' => 'Business Rules Debug',
'#collapsed' => TRUE,
'#collapsable' => TRUE,
];
$output['business_rules_debug']['debug'] = $debug;
}
}
return $output;
}