function views_add_block_contextual_links

Converts Views block content to a renderable array with contextual links.

Parameters

array $block: An array representing the block, with the same structure as the return value of hook_block_view(). This will be modified so as to force $block['content'] to be a renderable array, containing the optional '#contextual_links' property (if there are any contextual links associated with the block).

object $view: The view that was used to generate the block content.

string $display_id: The ID of the display within the view that was used to generate the block content.

string $block_type: The type of the block. If it's block it's a regular views display, but 'special_block_-exp' exist as well.

1 call to views_add_block_contextual_links()
views_block_view in ./views.module
Implements hook_block_view().

File

./views.module, line 885

Code

function views_add_block_contextual_links(&$block, $view, $display_id, $block_type = 'block') {
    // Do not add contextual links to an empty block.
    if (!empty($block['content'])) {
        // Contextual links only work on blocks whose content is a renderable
        // array, so if the block contains a string of already-rendered markup,
        // convert it to an array.
        if (is_string($block['content'])) {
            $block['content'] = array(
                '#markup' => $block['content'],
            );
        }
        // Add the contextual links.
        views_add_contextual_links($block['content'], $block_type, $view, $display_id);
    }
}