function ViewsUIController::edit

Same name in other branches
  1. 9 core/modules/views_ui/src/Controller/ViewsUIController.php \Drupal\views_ui\Controller\ViewsUIController::edit()
  2. 8.9.x core/modules/views_ui/src/Controller/ViewsUIController.php \Drupal\views_ui\Controller\ViewsUIController::edit()
  3. 11.x core/modules/views_ui/src/Controller/ViewsUIController.php \Drupal\views_ui\Controller\ViewsUIController::edit()

Returns the form to edit a view.

Parameters

\Drupal\views_ui\ViewUI $view: The view to be edited.

string|null $display_id: (optional) The display ID being edited. Defaults to NULL, which will load the first available display.

Return value

array An array containing the Views edit and preview forms.

1 string reference to 'ViewsUIController::edit'
views_ui.routing.yml in core/modules/views_ui/views_ui.routing.yml
core/modules/views_ui/views_ui.routing.yml

File

core/modules/views_ui/src/Controller/ViewsUIController.php, line 211

Class

ViewsUIController
Returns responses for Views UI routes.

Namespace

Drupal\views_ui\Controller

Code

public function edit(ViewUI $view, $display_id = NULL) {
    $name = $view->label();
    $data = $this->viewsData
        ->get($view->get('base_table'));
    if (isset($data['table']['base']['title'])) {
        $name .= ' (' . $data['table']['base']['title'] . ')';
    }
    $build['#title'] = $name;
    $build['edit'] = $this->entityFormBuilder()
        ->getForm($view, 'edit', [
        'display_id' => $display_id,
    ]);
    $build['preview'] = $this->entityFormBuilder()
        ->getForm($view, 'preview', [
        'display_id' => $display_id,
    ]);
    return $build;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.