renderPlaceholders example

// First, render the actual placeholders; this may cause additional     // attachments to be added to the response, which the attachment     // placeholders rendered by renderHtmlResponseAttachmentPlaceholders() will     // need to include.     //     // @todo Exceptions should not be used for code flow control. However, the     // Form API does not integrate with the HTTP Kernel based architecture of     // Drupal 8. In order to resolve this issue properly it is necessary to     // completely separate form submission from rendering.     // @see https://www.drupal.org/node/2367555     try {
      $response = $this->renderPlaceholders($response);
    }
    catch (EnforcedResponseException $e) {
      return $e->getResponse();
    }

    // Get a reference to the attachments.     $attached = $response->getAttachments();

    // Send a message back if the render array has unsupported #attached types.     $unsupported_types = array_diff(
      array_keys($attached),
      [
public function processAttachments(AttachmentsInterface $response) {
    assert($response instanceof HtmlResponse);

    // First, render the actual placeholders; this will cause the BigPipe     // placeholder strategy to generate BigPipe placeholders. We need those to     // exist already so that we can extract BigPipe placeholders. This is hence     // a bit of unfortunate but necessary duplication.     // @see \Drupal\big_pipe\Render\Placeholder\BigPipeStrategy     // (Note this is copied verbatim from     // \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::processAttachments)     try {
      $response = $this->renderPlaceholders($response);
    }
    catch (EnforcedResponseException $e) {
      return $e->getResponse();
    }

    // Extract BigPipe placeholders; HtmlResponseAttachmentsProcessor does not     // know (nor need to know) how to process those.     $attachments = $response->getAttachments();
    $big_pipe_placeholders = [];
    $big_pipe_nojs_placeholders = [];
    if (isset($attachments['big_pipe_placeholders'])) {
      
Home | Imprint | This part of the site doesn't use cookies.