You are here

class ViewsMegarowQuickEditController in Views Megarow 8

Hierarchy

Expanded class hierarchy of ViewsMegarowQuickEditController

File

src/Controller/ViewsMegarowQuickEditController.php, line 11

Namespace

Drupal\views_megarow\Controller
View source
class ViewsMegarowQuickEditController {
  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;
  }

}

Members