From f57a2145a3e6a615e97256845e8ee067b8aa7cbc Mon Sep 17 00:00:00 2001
From: Mark Carver <mark.carver@me.com>
Date: Thu, 25 Jan 2018 12:06:28 -0600
Subject: [PATCH] Issue #2939524 by markcarver, m.stenta: Notice: Undefined
 variable: grddl_profile in maintenance-page.tpl.php

Signed-off-by: Mark Carver <mark.carver@me.com>
---
 includes/registry.inc                      | 22 +++++++++++++++
 templates/system/maintenance-page.vars.php | 44 ------------------------------
 2 files changed, 22 insertions(+), 44 deletions(-)
 delete mode 100644 templates/system/maintenance-page.vars.php

diff --git a/includes/registry.inc b/includes/registry.inc
index fdf32ad..c0039ef 100644
--- a/includes/registry.inc
+++ b/includes/registry.inc
@@ -121,6 +121,28 @@ function bootstrap_theme_registry_alter(&$registry) {
   // and after all includes have been loaded.
   _bootstrap_process_theme_registry_suggestions($registry, $themes);
 
+  // Merge both "html" and "page" theme hooks into "maintenance_page". Create
+  // a fake "page" variable to satisfy both "html" and "page" preprocess/process
+  // functions. Whether or not they stumble over each other doesn't matter since
+  // the "maintenance_page" theme hook uses the "content" variable instead.
+  $registry['maintenance_page']['variables']['page'] = array(
+    '#show_messages' => TRUE,
+    '#children' => NULL,
+    'page_bottom' => array(),
+    'page_top' => array(),
+  );
+  foreach (array('html', 'page') as $theme_hook) {
+    foreach (array('includes', 'preprocess functions', 'process functions') as $property) {
+      if (!isset($registry['maintenance_page'][$property])) {
+        $registry['maintenance_page'][$property] = array();
+      }
+      if (!isset($registry[$theme_hook][$property])) {
+        $registry[$theme_hook][$property] = array();
+      }
+      $registry['maintenance_page'][$property] = array_merge($registry['maintenance_page'][$property], $registry[$theme_hook][$property]);
+    }
+  }
+
   // Post-process theme registry. This happens after all altering has occurred.
   foreach ($registry as $hook => $info) {
     // Ensure uniqueness.
diff --git a/templates/system/maintenance-page.vars.php b/templates/system/maintenance-page.vars.php
deleted file mode 100644
index a90dbc8..0000000
--- a/templates/system/maintenance-page.vars.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * @file
- * Stub file for "maintenance_page" theme hook [pre]process functions.
- */
-
-// Include the "html" and "page" preprocessing files.
-bootstrap_include('bootstrap', 'templates/system/html.vars.php');
-bootstrap_include('bootstrap', 'templates/system/page.vars.php');
-
-/**
- * Pre-processes variables for the "maintenance_page" theme hook.
- *
- * See template for list of available variables.
- *
- * @param array $variables
- *   An associative array of variables, passed by reference.
- *
- * @see maintenance-page.tpl.php
- *
- * @ingroup theme_preprocess
- */
-function bootstrap_preprocess_maintenance_page(array &$variables) {
-  bootstrap_preprocess_html($variables);
-  bootstrap_preprocess_page($variables);
-}
-
-/**
- * Processes variables for the "maintenance_page" theme hook.
- *
- * See template for list of available variables.
- *
- * @param array $variables
- *   An associative array of variables, passed by reference.
- *
- * @see maintenance-page.tpl.php
- *
- * @ingroup theme_process
- */
-function bootstrap_process_maintenance_page(array &$variables) {
-  bootstrap_process_html($variables);
-  bootstrap_process_page($variables);
-}
-- 
2.15.1

