renderArray example



  public function renderArrayEarly() {
    $render_array = $this->earlyRenderContent();
    return [
      '#markup' => $this->renderer->render($render_array),
    ];
  }

  public function ajaxResponse() {
    $response = new AjaxResponse();
    $response->addCommand(new InsertCommand(NULL, $this->renderArray()));
    return $response;
  }

  public function ajaxResponseEarly() {
    $response = new AjaxResponse();
    $response->addCommand(new InsertCommand(NULL, $this->renderArrayEarly()));
    return $response;
  }

  public function response() {
    return new Response('Hello world!');
  }
Home | Imprint | This part of the site doesn't use cookies.