You are here

public function ViewsMegarowQuickEditController::content in Views Megarow 8

1 string reference to 'ViewsMegarowQuickEditController::content'
views_megarow.routing.yml in ./views_megarow.routing.yml
views_megarow.routing.yml

File

src/Controller/ViewsMegarowQuickEditController.php, line 12

Class

ViewsMegarowQuickEditController

Namespace

Drupal\views_megarow\Controller

Code

public function content() {

  // Extra arguments are in $_REQUEST.
  $request = Drupal::service('request_stack');
  $current_request = $request
    ->getCurrentRequest();

  // @TODO: is it clean to retrieve the values from $_REQUEST?
  $url = new Url($_REQUEST['original_route_name'], $_REQUEST['original_arguments']);
  $subrequest = Request::create($url
    ->toString(), 'GET', $_REQUEST['original_arguments'], $current_request->cookies
    ->all(), array(), $current_request->server
    ->all());
  $subrequest->headers
    ->set('Accept', 'application/vnd.drupal-views-megarow');
  $content = Drupal::service('http_kernel')
    ->handle($subrequest, HttpKernelInterface::SUB_REQUEST);
  $response = new Ajax\AjaxResponse();
  $response
    ->addCommand(new Ajax\ReplaceCommand('.views-view-table', $content
    ->getContent()));
  return $response;
}