Skip to content

Instantly share code, notes, and snippets.

@LionsAd
Created September 13, 2015 15:13
Show Gist options
  • Select an option

  • Save LionsAd/924640a0b17842a5d765 to your computer and use it in GitHub Desktop.

Select an option

Save LionsAd/924640a0b17842a5d765 to your computer and use it in GitHub Desktop.
Half Pipe WIP
<?php
// ...
if (!empty($half_pipe_placeholders)) {
$extra_attachments = $this->doHalfPipe($page_parts[0], $half_pipe_placeholders);
// Print the extra attachments.
if (!empty($extra_attachments['library']) || !empty($extra_attachments['drupalSettings'])) {
$all_attachments = BubbleableMetadata::mergeAttachments($attachments, $extra_attachments);
// Update the extra libraries using the Response's ajax page state.
// In the ideal case this will be empty and all libraries have been
// to the bottom js section already.
$variables_extra = $this->htmlResponseAttachmentsProcessor->processAssetLibraries($extra_attachments, [ 'scripts' => 'TRUE', 'styles' => TRUE ], $this->ajaxPageState);
if (!empty($variables_extra['styles'])) {
print $this->renderer->renderRoot($variables_extra['styles']);
}
if (!empty($variables_extra['styles'])) {
print $this->renderer->renderRoot($variables_extra['scripts']);
}
// Update the bottom attachments with no ajax page state.
$variables = $this->htmlResponseAttachmentsProcessor->processAssetLibraries($all_attachments, [ 'scripts_bottom' => TRUE ]);
$scripts_bottom = $this->renderer->renderRoot($variables['scripts_bottom']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment