In #1914966-18: Nested contextual links triggers don't work well, webchick posted a screenshot that shows overlap of pencil icons for the contextual link wrapper for "Edit view" and the one for "Configure block". xjm was not able to replicate that in #1914966-22: Nested contextual links triggers don't work well, and neither can I. Instead, what I'm seeing is that the wrapper for the "Edit view" link doesn't get rendered at all for a block display.
There's this code in ViewsBlock::addContextualLinks() that implies contextual links are desired in block displays:
if (!empty($output)) {
// 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($output)) {
$output = array('#markup' => $output);
}
// Add the contextual links.
views_add_contextual_links($output, $block_type, $this->view, $this->displayID);
}
However, the statement "Contextual links only work on blocks whose content is a renderable array" is only partially true. The render array also has to be themed by a template, so that contextual_preprocess() runs on it, or else some other code needs to do what it does.
So, I think there's two related issues here:
1) The element that views_add_contextual_links() adds #contextual_links to needs to be one for which contextual_preprocess() or equivalent will run.
2) Ideally, that element should be the block itself, not a content element within the block, so that these contextual links are merged with the "configure block" one, similarly to how Menu blocks merge menu and block configuration into the same wrapper.