Skip to content
Snippets Groups Projects
Commit 8b3b8c67 authored by Alex Pott's avatar Alex Pott
Browse files

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

parent fe81cfac
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment