How to alter a rendered view

Overriding views is a little like forking: you don't get upstream core/plugin changes. In Elgg 1.8+ you can alter views--to do more surgical alterations--after they've been rendered. You do this using the "view" plugin hook.

Example: remove breadcrumbs that have no links

// arguments are 'view', the view name, and your handler callback
elgg_register_plugin_hook_handler('view', 'navigation/breadcrumbs', 'myPlugin_alter_breadcrumbs');

function myPlugin_alter_breadcrumbs($hook, $type, $returnValue, $params) {
    // $hook is 'view', $type is the view name, $returnValue is the string
    // output of the view, and $params['viewtype'] has the view type.

    if ($params['viewtype'] === 'default') {
        if (false === strpos($returnValue, '<a ')) {
            $returnValue = ''; // if no link, remove completely
    return $returnValue;