Commit a566566e authored by webchick's avatar webchick

Issue #2191011 by Stuart Miller, Cottser: PHP Warnings in...

Issue #2191011 by Stuart Miller, Cottser: PHP Warnings in views_preprocess_page() caused by frontpage view.
parent 13ada2ac
......@@ -149,4 +149,20 @@ protected function assertNotInResultSet(ViewExecutable $view, array $not_expecte
$this->assertFalse($found_nids, $message);
* Tests the frontpage when logged in as admin.
public function testAdminFrontPage() {
// When a user with sufficient permissions is logged in, views_ui adds
// contextual links to the homepage view. This verifies there are no errors.
// Login root user with sufficient permissions.
// Test frontpage view.
// Check that the frontpage view was rendered.
$this->assertPattern('/class=".+view-frontpage/', 'Frontpage view was rendered');
......@@ -320,7 +320,7 @@ function views_preprocess_page(&$variables) {
// page.html.twig, so we can only find it using JavaScript. We therefore
// remove the "contextual-region" class from the <body> tag here and add
// JavaScript that will insert it back in the correct place.
if (!empty($variables['page']['#views_contextual_links'])) {
if (!empty($variables['page']['#views_contextual_links']) && isset($variables['attributes']['class'])) {
/** @var \Drupal\Core\Page\HtmlPage $page_object */
$page_object = $variables['page']['#page'];
$attributes = $page_object->getBodyAttributes();
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