diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php new file mode 100644 index 0000000..85e689f --- /dev/null +++ b/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php @@ -0,0 +1,50 @@ + 'Handler test', + 'description' => 'Tests handler UI for views.', + 'group' => 'Views UI' + ); + } + + /** + * Tests UI CRUD. + */ + public function testUICRUD() { + $handler_types = ViewExecutable::viewsHandlerTypes(); + foreach (array_keys($handler_types) as $type) { + + // Test adding handlers. + $add_handler_url = "admin/structure/views/nojs/add-item/test_view/default/$type"; + $this->drupalPost($add_handler_url, array('name[views_test_data.created]' => TRUE), t('Add and configure fields')); + + $edit_handler_url = "admin/structure/views/nojs/config-item/test_view/default/$type/created"; + $this->assertUrl($edit_handler_url, array(), 'The user got redirected to the handler edit form.'); + $this->drupalPost(NULL, array(), t('Apply')); + + $this->assertUrl('admin/structure/views/view/test_view/edit', array(), 'The user got redirected to the views edit form.'); + + $this->assertLinkByHref($edit_handler_url, 0, 'The handler edit link appears in the UI.'); + + $this->drupalPost($edit_handler_url, array(), t('Remove')); + $this->assertLinkByHref($edit_handler_url, 0, 'The handler edit link does not appears in the UI after removing.'); + } + } + +} diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php index b9d966b..ff16fc3 100644 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php +++ b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php @@ -317,9 +317,9 @@ public function getDisplayTab($view) { // If the plugin doesn't exist, display an error message instead of an edit // page. if (empty($display)) { - $title = isset($display['display_title']) ? $display['display_title'] : t('Invalid'); + $title = isset($display->display['display_title']) ? $display->display['display_title'] : t('Invalid'); // @TODO: Improved UX for the case where a plugin is missing. - $build['#markup'] = t("Error: Display @display refers to a plugin named '@plugin', but that plugin is not available.", array('@display' => $display['id'], '@plugin' => $display['display_plugin'])); + $build['#markup'] = t("Error: Display @display refers to a plugin named '@plugin', but that plugin is not available.", array('@display' => $display->display['id'], '@plugin' => $display->display['display_plugin'])); } // Build the content of the edit page. else { @@ -592,12 +592,13 @@ public function submitDisplayDelete($form, &$form_state) { * Regenerate the current tab for AJAX updates. */ public function rebuildCurrentTab(ViewUI $view, &$output, $display_id) { + $view->displayID = $display_id; if (!$view->get('executable')->setDisplay('default')) { return; } // Regenerate the main display area. - $build = static::getDisplayTab($this); + $build = $this->getDisplayTab($view); static::addMicroweights($build); $output[] = ajax_command_html('#views-tab-' . $display_id, drupal_render($build));