Loading core/modules/views/src/Controller/ViewAjaxController.php +6 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Routing\Attribute\Route; /** * Defines a controller to load a view via AJAX. Loading Loading @@ -81,6 +82,11 @@ public static function create(ContainerInterface $container) { * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * Thrown when the view was not found. */ #[Route( path: '/views/ajax', name: 'views.ajax', requirements: ['_access' => 'TRUE'], )] public function ajaxView(Request $request) { $name = $request->query->get('view_name', $request->request->get('view_name')); $display_id = $request->query->get('view_display_id', $request->request->get('view_display_id')); Loading core/modules/views/views.routing.yml +0 −7 Original line number Diff line number Diff line views.ajax: path: '/views/ajax' defaults: _controller: '\Drupal\views\Controller\ViewAjaxController::ajaxView' requirements: _access: 'TRUE' route_callbacks: - 'views.route_subscriber:routes' core/modules/views_ui/src/Controller/ViewsUIController.php +64 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ use Drupal\Component\Utility\Tags; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Link; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Url; use Drupal\views\ViewExecutable; use Drupal\views\ViewEntityInterface; Loading @@ -16,6 +17,7 @@ use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Ajax\ReplaceCommand; use Drupal\Component\Utility\Html; use Symfony\Component\Routing\Attribute\Route; /** * Returns responses for Views UI routes. Loading Loading @@ -45,6 +47,12 @@ public function __construct(ViewsData $views_data) { * @return array * The Views fields report page. */ #[Route( path: '/admin/reports/fields/views-fields', name: 'views_ui.reports_fields', requirements: ['_permission' => 'administer views'], defaults: ['_title' => new TranslatableMarkup('Used in views')], )] public function reportFields() { $views = $this->entityTypeManager()->getStorage('view')->loadMultiple(); Loading Loading @@ -106,6 +114,12 @@ public function reportFields() { * @return array * The Views plugins report page. */ #[Route( path: '/admin/reports/views-plugins', name: 'views_ui.reports_plugins', requirements: ['_permission' => 'administer views'], defaults: ['_title' => new TranslatableMarkup('Views plugins')], )] public function reportPlugins() { $rows = Views::pluginList(); foreach ($rows as &$row) { Loading Loading @@ -146,6 +160,24 @@ public function reportPlugins() { * Either returns a rebuilt listing page as an AJAX response, or redirects * back to the listing page. */ #[Route( path: '/admin/structure/views/view/{view}/enable', name: 'entity.view.enable', defaults: ['op' => 'enable'], requirements: [ '_entity_access' => 'view.enable', '_csrf_token' => 'TRUE', ], )] #[Route( path: '/admin/structure/views/view/{view}/disable', name: 'entity.view.disable', defaults: ['op' => 'disable'], requirements: [ '_entity_access' => 'view.disable', '_csrf_token' => 'TRUE', ], )] public function ajaxOperation(ViewEntityInterface $view, $op, Request $request) { // Perform the operation. $view->$op()->save(); Loading @@ -171,6 +203,11 @@ public function ajaxOperation(ViewEntityInterface $view, $op, Request $request) * @return \Symfony\Component\HttpFoundation\JsonResponse * A JSON response containing the autocomplete suggestions for Views tags. */ #[Route( path: '/admin/views/ajax/autocomplete/tag', name: 'views_ui.autocomplete', requirements: ['_permission' => 'administer views'], )] public function autocompleteTag(Request $request) { $matches = []; $string = $request->query->get('q'); Loading Loading @@ -208,6 +245,33 @@ public function autocompleteTag(Request $request) { * @return array * An array containing the Views edit and preview forms. */ #[Route( path: '/admin/structure/views/view/{view}', name: 'entity.view.edit_form', options: [ 'parameters' => [ 'view' => [ 'tempstore' => TRUE, 'type' => 'entity:view', ], ], ], requirements: ['_entity_access' => 'view.update'], )] #[Route( path: '/admin/structure/views/view/{view}/edit/{display_id}', name: 'entity.view.edit_display_form', defaults: ['display_id' => NULL], options: [ 'parameters' => [ 'view' => [ 'tempstore' => TRUE, 'type' => 'entity:view', ], ], ], requirements: ['_entity_access' => 'view.update'], )] public function edit(ViewUI $view, $display_id = NULL) { $name = $view->label(); $data = $this->viewsData->get($view->get('base_table')); Loading core/modules/views_ui/src/Form/AdvancedSettingsForm.php +12 −0 Original line number Diff line number Diff line Loading @@ -4,13 +4,25 @@ use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\views\Views; use Symfony\Component\Routing\Attribute\Route; /** * Form builder for the advanced admin settings page. * * @internal */ #[Route( path: '/admin/structure/views/settings/advanced', name: 'views_ui.settings_advanced', requirements: [ '_permission' => 'administer views', ], defaults: [ '_title' => new TranslatableMarkup('Advanced Views settings'), ], )] class AdvancedSettingsForm extends ConfigFormBase { /** Loading core/modules/views_ui/src/Form/BasicSettingsForm.php +12 −0 Original line number Diff line number Diff line Loading @@ -5,12 +5,24 @@ use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\RedundantEditableConfigNamesTrait; use Drupal\Core\StringTranslation\TranslatableMarkup; use Symfony\Component\Routing\Attribute\Route; /** * Form builder for the admin display defaults page. * * @internal */ #[Route( path: '/admin/structure/views/settings', name: 'views_ui.settings_basic', requirements: [ '_permission' => 'administer views', ], defaults: [ '_title' => new TranslatableMarkup('Views settings'), ], )] class BasicSettingsForm extends ConfigFormBase { use RedundantEditableConfigNamesTrait; Loading Loading
core/modules/views/src/Controller/ViewAjaxController.php +6 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Routing\Attribute\Route; /** * Defines a controller to load a view via AJAX. Loading Loading @@ -81,6 +82,11 @@ public static function create(ContainerInterface $container) { * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * Thrown when the view was not found. */ #[Route( path: '/views/ajax', name: 'views.ajax', requirements: ['_access' => 'TRUE'], )] public function ajaxView(Request $request) { $name = $request->query->get('view_name', $request->request->get('view_name')); $display_id = $request->query->get('view_display_id', $request->request->get('view_display_id')); Loading
core/modules/views/views.routing.yml +0 −7 Original line number Diff line number Diff line views.ajax: path: '/views/ajax' defaults: _controller: '\Drupal\views\Controller\ViewAjaxController::ajaxView' requirements: _access: 'TRUE' route_callbacks: - 'views.route_subscriber:routes'
core/modules/views_ui/src/Controller/ViewsUIController.php +64 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ use Drupal\Component\Utility\Tags; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Link; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Url; use Drupal\views\ViewExecutable; use Drupal\views\ViewEntityInterface; Loading @@ -16,6 +17,7 @@ use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Ajax\ReplaceCommand; use Drupal\Component\Utility\Html; use Symfony\Component\Routing\Attribute\Route; /** * Returns responses for Views UI routes. Loading Loading @@ -45,6 +47,12 @@ public function __construct(ViewsData $views_data) { * @return array * The Views fields report page. */ #[Route( path: '/admin/reports/fields/views-fields', name: 'views_ui.reports_fields', requirements: ['_permission' => 'administer views'], defaults: ['_title' => new TranslatableMarkup('Used in views')], )] public function reportFields() { $views = $this->entityTypeManager()->getStorage('view')->loadMultiple(); Loading Loading @@ -106,6 +114,12 @@ public function reportFields() { * @return array * The Views plugins report page. */ #[Route( path: '/admin/reports/views-plugins', name: 'views_ui.reports_plugins', requirements: ['_permission' => 'administer views'], defaults: ['_title' => new TranslatableMarkup('Views plugins')], )] public function reportPlugins() { $rows = Views::pluginList(); foreach ($rows as &$row) { Loading Loading @@ -146,6 +160,24 @@ public function reportPlugins() { * Either returns a rebuilt listing page as an AJAX response, or redirects * back to the listing page. */ #[Route( path: '/admin/structure/views/view/{view}/enable', name: 'entity.view.enable', defaults: ['op' => 'enable'], requirements: [ '_entity_access' => 'view.enable', '_csrf_token' => 'TRUE', ], )] #[Route( path: '/admin/structure/views/view/{view}/disable', name: 'entity.view.disable', defaults: ['op' => 'disable'], requirements: [ '_entity_access' => 'view.disable', '_csrf_token' => 'TRUE', ], )] public function ajaxOperation(ViewEntityInterface $view, $op, Request $request) { // Perform the operation. $view->$op()->save(); Loading @@ -171,6 +203,11 @@ public function ajaxOperation(ViewEntityInterface $view, $op, Request $request) * @return \Symfony\Component\HttpFoundation\JsonResponse * A JSON response containing the autocomplete suggestions for Views tags. */ #[Route( path: '/admin/views/ajax/autocomplete/tag', name: 'views_ui.autocomplete', requirements: ['_permission' => 'administer views'], )] public function autocompleteTag(Request $request) { $matches = []; $string = $request->query->get('q'); Loading Loading @@ -208,6 +245,33 @@ public function autocompleteTag(Request $request) { * @return array * An array containing the Views edit and preview forms. */ #[Route( path: '/admin/structure/views/view/{view}', name: 'entity.view.edit_form', options: [ 'parameters' => [ 'view' => [ 'tempstore' => TRUE, 'type' => 'entity:view', ], ], ], requirements: ['_entity_access' => 'view.update'], )] #[Route( path: '/admin/structure/views/view/{view}/edit/{display_id}', name: 'entity.view.edit_display_form', defaults: ['display_id' => NULL], options: [ 'parameters' => [ 'view' => [ 'tempstore' => TRUE, 'type' => 'entity:view', ], ], ], requirements: ['_entity_access' => 'view.update'], )] public function edit(ViewUI $view, $display_id = NULL) { $name = $view->label(); $data = $this->viewsData->get($view->get('base_table')); Loading
core/modules/views_ui/src/Form/AdvancedSettingsForm.php +12 −0 Original line number Diff line number Diff line Loading @@ -4,13 +4,25 @@ use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\views\Views; use Symfony\Component\Routing\Attribute\Route; /** * Form builder for the advanced admin settings page. * * @internal */ #[Route( path: '/admin/structure/views/settings/advanced', name: 'views_ui.settings_advanced', requirements: [ '_permission' => 'administer views', ], defaults: [ '_title' => new TranslatableMarkup('Advanced Views settings'), ], )] class AdvancedSettingsForm extends ConfigFormBase { /** Loading
core/modules/views_ui/src/Form/BasicSettingsForm.php +12 −0 Original line number Diff line number Diff line Loading @@ -5,12 +5,24 @@ use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\RedundantEditableConfigNamesTrait; use Drupal\Core\StringTranslation\TranslatableMarkup; use Symfony\Component\Routing\Attribute\Route; /** * Form builder for the admin display defaults page. * * @internal */ #[Route( path: '/admin/structure/views/settings', name: 'views_ui.settings_basic', requirements: [ '_permission' => 'administer views', ], defaults: [ '_title' => new TranslatableMarkup('Views settings'), ], )] class BasicSettingsForm extends ConfigFormBase { use RedundantEditableConfigNamesTrait; Loading