Commit 742908a6 authored by alexpott's avatar alexpott
Browse files

Issue #2057427 by dawehner, olli: Fixed No delete operation available while editing a view.

parent cc1f3fde
<?php
/**
* @file
* Contains \Drupal\views_ui\Tests\ViewEditTest.
*/
namespace Drupal\views_ui\Tests;
use Drupal\views\Plugin\Core\Entity\View;
/**
* Tests some general functionality of editing views, like deleting a view.
*/
class ViewEditTest extends UITestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = array('test_view');
public static function getInfo() {
return array(
'name' => 'General views edit test',
'description' => 'Tests some general functionality of editing views, like deleting a view.',
'group' => 'Views UI'
);
}
/**
* Tests the delete link on a views UI.
*/
public function testDeleteLink() {
$this->drupalGet('admin/structure/views/view/test_view');
$this->assertLink(t('Delete view'), 0, 'Ensure that the view delete link appears');
$this->clickLink(t('Delete view'));
$this->assertUrl('admin/structure/views/view/test_view/delete');
$this->drupalPost(NULL, array(), t('Delete'));
$this->assertUrl('admin/structure/views');
$view = $this->container->get('plugin.manager.entity')->getStorageController('view')->load('test_view');
$this->assertFalse($view instanceof View);
}
}
......@@ -682,6 +682,13 @@ public function renderDisplayTop(ViewUI $view) {
),
);
if ($view->access('delete')) {
$element['extra_actions']['#links']['delete'] = array(
'title' => $this->t('Delete view'),
'href' => "admin/structure/views/view/{$view->id()}/delete",
);
}
// Let other modules add additional links here.
\Drupal::moduleHandler()->alter('views_ui_display_top_links', $element['extra_actions']['#links'], $view, $display_id);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment