diff --git a/core/modules/views/views_ui/admin.inc b/core/modules/views/views_ui/admin.inc index 9f57a51..857fb19 100644 --- a/core/modules/views/views_ui/admin.inc +++ b/core/modules/views/views_ui/admin.inc @@ -691,7 +691,11 @@ function views_ui_edit_details_form_submit($form, &$form_state) { $view->set($key, $value); } } - $form_state['#page_title'] = views_ui_edit_page_title($view); + $bases = views_fetch_base_tables(); + $form_state['#page_title'] = $view->getHumanName(); + if (isset($bases[$view->get('base_table')])) { + $form_state['#page_title'] .= ' (' . $bases[$view->get('base_table')]['title'] . ')'; + } views_ui_cache_set($view); } diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/Routing/ViewsUIController.php b/core/modules/views/views_ui/lib/Drupal/views_ui/Routing/ViewsUIController.php index 295a4e0..0f76455 100644 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/Routing/ViewsUIController.php +++ b/core/modules/views/views_ui/lib/Drupal/views_ui/Routing/ViewsUIController.php @@ -61,16 +61,21 @@ class ViewsUIController { * The Views data cache object. * @param \Symfony\Component\HttpFoundation\Request $request * The request object. + * @param \Drupal\user\TempStoreFactory $temp_store_factory + * The factory for the temp store object. */ - public function __construct(EntityManager $entity_manager, ViewsDataCache $views_data, Request $request, TempStoreFactory $temp_store) { + public function __construct(EntityManager $entity_manager, ViewsDataCache $views_data, Request $request, TempStoreFactory $temp_store_factory) { $this->entityManager = $entity_manager; $this->viewsData = $views_data; $this->request = $request; - $this->tempStore = $temp_store->get('views'); + $this->tempStore = $temp_store_factory->get('views'); } /** * Lists all of the views. + * + * @return array + * The Views listing page. */ public function listing() { return $this->entityManager->getListController('view')->render(); @@ -78,17 +83,22 @@ public function listing() { /** * Returns the form to add a new view. + * + * @return array + * The Views add form. */ public function add() { drupal_set_title(t('Add new view')); $entity = $this->entityManager->getStorageController('view')->create(array()); - return entity_get_form($entity, 'add'); } /** * Form builder for the admin display defaults page. + * + * @return array + * The Views basic settings form. */ public function settingsBasic() { // @todo Remove the need for this. @@ -98,6 +108,9 @@ public function settingsBasic() { /** * Form builder for the advanced admin settings page. + * + * @return array + * The Views advanced settings form. */ public function settingsAdvanced() { // @todo Remove the need for this. @@ -107,6 +120,9 @@ public function settingsAdvanced() { /** * Lists all instances of fields on any views. + * + * @return array + * The Views fields report page. */ public function reportFields() { $views = $this->entityManager->getStorageController('view')->load(); @@ -139,7 +155,6 @@ public function reportFields() { $header = array(t('Field name'), t('Used in')); $rows = array(); foreach ($fields as $field_name => $views) { - $rows[$field_name]['data'][0] = check_plain($field_name); foreach ($views as $view) { $rows[$field_name]['data'][1][] = l($view, "admin/structure/views/view/$view"); @@ -161,6 +176,9 @@ public function reportFields() { /** * Lists all plugins and what enabled Views use them. + * + * @return array + * The Views plugins report page. */ public function reportPlugins() { $rows = views_plugin_list(); @@ -191,8 +209,8 @@ public function reportPlugins() { * The operation to perform, e.g., 'enable' or 'disable'. * * @return \Drupal\Core\Ajax\AjaxResponse|\Symfony\Component\HttpFoundation\RedirectResponse - * Either returns the listing page as JSON, or redirects back to the - * listing page. + * Either returns a rebuilt listing page as an AJAX response, or redirects + * back to the listing page. */ public function ajaxOperation($view, $op) { // @todo Remove this when http://drupal.org/node/1798214 is in. @@ -281,8 +299,8 @@ public function autocompleteTag() { * @param string|\Drupal\views_ui\ViewUI $views_ui * The view being deleted. * @param string|null $display_id - * (optional) The display ID being edited. Defaults to NULL, which will - * load the first available display. + * (optional) The display ID being edited. Defaults to NULL, which will load + * the first available display. * * @return array * An array containing the Views edit and preview forms. @@ -364,7 +382,8 @@ public function breakLock($views_ui) { * 'config-item' has 'sytle' as a handler type. Defaults to NULL, if the * section has no subsections. * @param string|null $id - * If $key is 'config-item', then this will be the plugin ID of the handler. + * (optional) If $key is 'config-item', then this will be the plugin ID of + * the handler. Defaults to NULL. * * @return array * An form for a specific operation in the Views UI, or an array of AJAX @@ -389,7 +408,7 @@ public function ajaxForm($js, $views_ui, $key, $display_id = NULL, $type = NULL, } /** - * Provides temporary upcasting for View entities until there is generic handling. + * Provides upcasting for View entities until there is generic handling. * * @param string|\Drupal\views\ViewStorageInterface $view * The view being loaded. @@ -404,7 +423,7 @@ protected function upcastView($view) { return $view; } - $results = $this->entityManager->getStorageController('view')->load($name); + $results = $this->entityManager->getStorageController('view')->load(array($view)); $entity = reset($results); if (!($entity instanceof ViewStorageInterface)) { throw new \Exception(format_string("Could not load view '@view'.", array('@view' => $view))); @@ -419,15 +438,14 @@ protected function upcastView($view) { * The machine name of the view. * * @return \Drupal\views_ui\ViewUI|false - * Either the view object, with a "locked" property indicating whether or + * Either the view object, with a 'locked' property indicating whether or * not someone else is already editing the view, or FALSE if the view could * not be loaded. */ public function getViewUI($name) { $view = $this->tempStore->get($name); $results = $this->entityManager->getStorageController('view')->load(array($name)); - $storage = reset($results); - $original_view = $storage ? new ViewUI($storage) : NULL; + $original_view = !empty($results) ? new ViewUI(reset($results)) : NULL; if (empty($view)) { $view = $original_view; diff --git a/core/modules/views/views_ui/views_ui.module b/core/modules/views/views_ui/views_ui.module index 57f3c95..818344f 100644 --- a/core/modules/views/views_ui/views_ui.module +++ b/core/modules/views/views_ui/views_ui.module @@ -9,8 +9,6 @@ use Drupal\views\ViewStorageInterface; use Drupal\views_ui\ViewUI; use Drupal\views\Analyzer; -use Drupal\Core\Entity\EntityInterface; -use Symfony\Component\HttpFoundation\JsonResponse; /** * Implements hook_menu().