Helper to return an expected views option array.
array $views: An array of Drupal\views\Plugin\Core\Entity\View objects for which to create an options array.
array A formatted options array that matches the expected output.
protected function formatViewOptions(array $views = array()) {
$expected_options = array();
foreach ($views as $id => $view) {
foreach ($view
->get('display') as $display_id => $display) {
$expected_options[$view
->id() . ':' . $display['id']] = t('View: @view - Display: @display', array(
'@view' => $view
->id(),
'@display' => $display['id'],
));
}
}
return $expected_options;
}