Commit 34425282 authored by larowlan's avatar larowlan

Issue #2744663 by jholding, rivimey, John Cook, hctom, mahalingam_cs: Batch missing title on screen

parent 58198494
...@@ -61,11 +61,22 @@ public function batchPage(Request $request) { ...@@ -61,11 +61,22 @@ public function batchPage(Request $request) {
return $output; return $output;
} }
elseif (isset($output)) { elseif (isset($output)) {
$title = isset($output['#title']) ? $output['#title'] : NULL;
$page = [ $page = [
'#type' => 'page', '#type' => 'page',
'#title' => $title,
'#show_messages' => FALSE, '#show_messages' => FALSE,
'content' => $output, 'content' => $output,
]; ];
// Also inject title as a page header (if available).
if ($title) {
$page['header'] = [
'#type' => 'page_title',
'#title' => $title,
];
}
return $page; return $page;
} }
} }
......
...@@ -50,7 +50,15 @@ public function testBatchProgressPageTitle() { ...@@ -50,7 +50,15 @@ public function testBatchProgressPageTitle() {
// Visit an administrative page that runs a test batch, and check that the // Visit an administrative page that runs a test batch, and check that the
// title shown during batch execution (which the batch callback function // title shown during batch execution (which the batch callback function
// saved as a variable) matches the theme used on the administrative page. // saved as a variable) matches the theme used on the administrative page.
// Run initial step only first.
$this->maximumMetaRefreshCount = 0;
$this->drupalGet('batch-test/test-title');
$this->assertText('Batch Test', 'The test is in the html output.');
// Leave the batch process running.
$this->maximumMetaRefreshCount = NULL;
$this->drupalGet('batch-test/test-title'); $this->drupalGet('batch-test/test-title');
// The stack should contain the title shown on the progress page. // The stack should contain the title shown on the progress page.
$this->assertEqual(batch_test_stack(), ['Batch Test'], 'The batch title is shown on the batch page.'); $this->assertEqual(batch_test_stack(), ['Batch Test'], 'The batch title is shown on the batch page.');
$this->assertText('Redirection successful.', 'Redirection after batch execution is correct.'); $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
......
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