function hook_mongodb_block_ui_view_alter in MongoDB 7
Perform alterations to the content of a mongodb_block_ui.
This hook allows you to modify any data returned by hook_mongodb_block_ui_view().
Note that instead of hook_mongodb_block_ui_view_alter(), which is called for all mongodb_block_uis, you can also use hook_mongodb_block_ui_view_MODULE_DELTA_alter() to alter a specific mongodb_block_ui.
Parameters
array $data: An array of data, as returned from the hook_mongodb_block_ui_view() implementation of the module that defined the mongodb_block_ui:
- subject: The localized title of the mongodb_block_ui.
- content: Either a string or a renderable array representing the content of the mongodb_block_ui. You should check that the content is an array before trying to modify parts of the renderable structure.
object $mongodb_block_ui: The mongodb_block_ui object, as loaded from the database, having the main properties:
- module: The name of the module that defined the mongodb_block_ui.
- delta: The identifier for the mongodb_block_ui within that module, as defined within hook_mongodb_block_ui_info().
See also
hook_mongodb_block_ui_view_alter()
File
- mongodb_block_ui/
mongodb_block_ui.api.php, line 192 - Hooks provided by the Block module.
Code
function hook_mongodb_block_ui_view_alter(array &$data, $mongodb_block_ui) {
// Remove the contextual links on all mongodb_block_uis that provide them.
if (is_array($data['content']) && isset($data['content']['#contextual_links'])) {
unset($data['content']['#contextual_links']);
}
// Add a theme wrapper function defined by the current module to all
// mongodb_block_uis provided by the "somemodule" module.
if (is_array($data['content']) && $mongodb_block_ui->module == 'somemodule') {
$data['content']['#theme_wrappers'][] = 'mymodule_special_mongodb_block_ui';
}
}