Issue #3342891 by lauriii, smustgrave, andy-blum, catch: 'node' variable in page.html.twig is not available on preview node page

merge-requests/3575/head
bnjmnm 2023-03-01 08:34:25 -05:00
parent 533b9483b7
commit cad17767c4
2 changed files with 7 additions and 1 deletions

View File

@ -1374,7 +1374,7 @@ function template_preprocess_page(&$variables) {
$variables['db_is_active'] = FALSE;
}
if ($node = \Drupal::routeMatch()->getParameter('node')) {
if (($node = \Drupal::routeMatch()->getParameter('node')) || ($node = \Drupal::routeMatch()->getParameter('node_preview'))) {
$variables['node'] = $node;
}
}

View File

@ -128,6 +128,12 @@ class DemoUmamiProfileTest extends BrowserTestBase {
$node = reset($nodes);
$this->drupalGet($node->toUrl('edit-form'));
$webassert->statusCodeEquals('200');
$this->submitForm([], 'Preview');
$webassert->statusCodeEquals('200');
$this->assertSession()->elementsCount('css', 'h1', 1);
$this->clickLink('Back to content editing');
$this->submitForm([], "Save");
$webassert->pageTextContains('Recipe Deep mediterranean quiche has been updated.');
}