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 =
['#markup' =>
$output];
} // views_add_contextual_links() needs the following information in
// order to be attached to the view.
$output['#view_id'
] =
$this->view->storage->
id();
$output['#view_display_show_admin_links'
] =
$this->view->
getShowAdminLinks();
$output['#view_display_plugin_id'
] =
$this->view->display_handler->
getPluginId();
views_add_contextual_links($output,
$block_type,
$this->displayID
);
} } /**
* Gets the view executable.
*
* @return \Drupal\views\ViewExecutable
* The view executable.
*
* @todo revisit after https://www.drupal.org/node/3027653. This method was
* added in https://www.drupal.org/node/3002608, but should not be
* necessary once block plugins can determine if they are being previewed.
*/