Commit 8b3b8c67 authored by alexpott's avatar alexpott

Issue #2564547 by Mile23, ianthomas_uk: Remove calls to drupal_process_attached

parent fe81cfac
......@@ -61,9 +61,15 @@ function testBasicFeedAddNoTitle() {
$build['#attached']['feed'][] = [$feed_info['url'], $feed_info['title']];
}
drupal_process_attached($build);
// Use the bare HTML page renderer to render our links.
$renderer = $this->container->get('bare_html_page_renderer');
$response = $renderer->renderBarePage(
$build, '', $this->container->get('theme.manager')->getActiveTheme()->getName()
);
// Glean the content from the response object.
$this->setRawContent($response->getContent());
$this->setRawContent(drupal_get_html_head());
// Assert that the content contains the RSS links we specified.
foreach ($urls as $description => $feed_info) {
$this->assertPattern($this->urlToRSSLinkPattern($feed_info['url'], $feed_info['title']), format_string('Found correct feed header for %description', array('%description' => $description)));
}
......
......@@ -53,17 +53,17 @@ function testDrupalRenderThemePreprocessAttached() {
}
/**
* Tests drupal_process_attached().
* Tests that we get an exception when we try to attach an illegal type.
*/
public function testDrupalProcessAttached() {
// Specify invalid attachments in a render array.
$build['#attached']['library'][] = 'core/drupal.states';
$build['#attached']['drupal_process_states'][] = [];
try {
drupal_process_attached($build);
$this->render($build);
$this->fail("Invalid #attachment 'drupal_process_states' allowed");
}
catch (\Exception $e) {
catch (\LogicException $e) {
$this->pass("Invalid #attachment 'drupal_process_states' not allowed");
}
}
......
......@@ -222,8 +222,6 @@ protected function ajaxFormWrapper($form_class, FormStateInterface &$form_state)
}
$output = $renderer->renderRoot($form);
drupal_process_attached($form);
// These forms have the title built in, so set the title here:
$title = $form_state->get('title') ?: '';
......
......@@ -869,9 +869,14 @@ protected function disableModules(array $modules) {
* The rendered string output (typically HTML).
*/
protected function render(array &$elements) {
$content = $this->container->get('renderer')->render($elements);
drupal_process_attached($elements);
$this->setRawContent($content);
// Use the bare HTML page renderer to render our links.
$renderer = $this->container->get('bare_html_page_renderer');
$response = $renderer->renderBarePage(
$build, '', $this->container->get('theme.manager')->getActiveTheme()->getName()
);
// Glean the content from the response object.
$this->setRawContent($response->getContent());
$this->verbose('<pre style="white-space: pre-wrap">' . Html::escape($content));
return $content;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment