diff --git a/core/includes/install.inc b/core/includes/install.inc index 84dd851..5111916 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -95,7 +95,7 @@ function drupal_install_profile_distribution_name() { // installation state (it might not be saved anywhere yet). if (drupal_installation_attempted()) { global $install_state; - return $install_state['profile_info']['distribution_name']; + return isset($install_state['profile_info']['distribution_name']) ? $install_state['profile_info']['distribution_name'] : 'Drupal'; } // At all other times, we load the profile via standard methods. else { diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 011db8d..76e5ba6 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -387,6 +387,45 @@ function _theme_save_registry($theme, $registry) { } /** + * Adds mobile friendly meta tags to the head of the HTML page. + */ +function _theme_add_mobile_meta_tags() { + $elements = array( + 'MobileOptimized' => array( + '#tag' => 'meta', + '#attributes' => array( + 'name' => 'MobileOptimized', + 'content' => 'width', + ), + ), + 'HandheldFriendly' => array( + '#tag' => 'meta', + '#attributes' => array( + 'name' => 'HandheldFriendly', + 'content' => 'true', + ), + ), + 'viewport' => array( + '#tag' => 'meta', + '#attributes' => array( + 'name' => 'viewport', + 'content' => 'width=device-width', + ), + ), + 'cleartype' => array( + '#tag' => 'meta', + '#attributes' => array( + 'http-equiv' => 'cleartype', + 'content' => 'on', + ), + ), + ); + foreach ($elements as $name => $element) { + drupal_add_html_head($element, $name); + } +} + +/** * Forces the system to rebuild the theme registry. * * This function should be called when modules are added to the system, or when @@ -2737,40 +2776,8 @@ function template_preprocess_html(&$variables) { $variables['head_title_array'] = $head_title; $variables['head_title'] = implode(' | ', $head_title); - // Display the html.tpl.php's default mobile metatags for responsive design. - $elements = array( - 'MobileOptimized' => array( - '#tag' => 'meta', - '#attributes' => array( - 'name' => 'MobileOptimized', - 'content' => 'width', - ), - ), - 'HandheldFriendly' => array( - '#tag' => 'meta', - '#attributes' => array( - 'name' => 'HandheldFriendly', - 'content' => 'true', - ), - ), - 'viewport' => array( - '#tag' => 'meta', - '#attributes' => array( - 'name' => 'viewport', - 'content' => 'width=device-width', - ), - ), - 'cleartype' => array( - '#tag' => 'meta', - '#attributes' => array( - 'http-equiv' => 'cleartype', - 'content' => 'on', - ), - ), - ); - foreach ($elements as $name => $element) { - drupal_add_html_head($element, $name); - } + // Display the default mobile metatags for responsive design. + _theme_add_mobile_meta_tags(); // Populate the page template suggestions. if ($suggestions = theme_get_suggestions(arg(), 'html')) { @@ -2783,9 +2790,12 @@ function template_preprocess_html(&$variables) { * * Default template: page.html.twig. * - * Most themes utilize their own copy of page.html.twig. The default is located - * inside "modules/system/page.html.twig". Look in there for the full list of - * variables. + * @param array $variables + * An associative array. + * + * Most themes provide their own copy of page.html.twig. The default is located + * inside "modules/system/templates/page.html.twig". Look in there for the full + * list of variables. * * Uses the arg() function to generate a series of page template suggestions * based on the current path. @@ -3044,7 +3054,7 @@ function template_preprocess_maintenance_page(&$variables) { $site_name = $site_config->get('name'); $site_slogan = $site_config->get('slogan'); - // Construct page title + // Construct page title. if (drupal_get_title()) { $head_title = array( 'title' => strip_tags(drupal_get_title()), @@ -3093,6 +3103,9 @@ function template_preprocess_maintenance_page(&$variables) { $variables['attributes']['class'][] = 'sidebar-' . $variables['layout']; } + // Display the default mobile metatags for responsive design. + _theme_add_mobile_meta_tags(); + // Dead databases will show error messages so supplying this template will // allow themers to override the page and the content completely. if (isset($variables['db_is_active']) && !$variables['db_is_active']) { @@ -3124,14 +3137,44 @@ function template_process_maintenance_page(&$variables) { } /** - * Preprocess variables for region.tpl.php + * Prepare variables for install page templates. + * + * Default template: install-page.html.twig + * + * @param array $variables + * An associative array containing: + * - @todo * - * Prepares the values passed to the theme_region function to be passed into a - * pluggable template engine. Uses the region name to generate a template file - * suggestions. If none are found, the default region.tpl.php is used. + * @see template_preprocess_maintenance_page() + */ +function template_preprocess_install_page(&$variables) { + template_preprocess_maintenance_page($variables); + // Override the site name that is displayed on the page, since Drupal is + // still in the process of being installed. + $variables['site_name'] = drupal_install_profile_distribution_name(); +} + +/** + * Preprocess variables for install-page.tpl.php. + * + * @see install-page.html.twig + * @see template_process_html() + * @todo Remove this function. + */ +function template_process_install_page(&$variables) { + template_process_maintenance_page($variables); +} + +/** + * Prepare variables for region templates. + * + * Default template: region.html.twig + * + * @param array $variables + * An associative array containing: + * - elements: @todo * * @see drupal_region_class() - * @see region.tpl.php */ function template_preprocess_region(&$variables) { // Create the $content variable that templates expect. @@ -3234,7 +3277,8 @@ function drupal_common_theme() { 'template' => 'maintenance-page', ), 'install_page' => array( - 'variables' => array('content' => NULL), + 'variables' => array('content' => NULL, 'show_messages' => TRUE), + 'template' => 'install-page', ), 'task_list' => array( 'variables' => array('items' => NULL, 'active' => NULL), diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index 9215957..1001ba1 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -148,20 +148,6 @@ function theme_task_list($variables) { } /** - * Returns HTML for the installation page. - * - * Note: this function is not themeable. - * - * @param $variables - * An associative array containing: - * - content: The page content to show. - */ -function theme_install_page($variables) { - drupal_add_http_header('Content-Type', 'text/html; charset=utf-8'); - return theme('maintenance_page', $variables); -} - -/** * Returns HTML for a results report of an operation run by authorize.php. * * @param $variables diff --git a/core/modules/system/templates/maintenance-page.html.twig b/core/modules/system/templates/maintenance-page.html.twig index a57b546..f4060cf 100644 --- a/core/modules/system/templates/maintenance-page.html.twig +++ b/core/modules/system/templates/maintenance-page.html.twig @@ -13,9 +13,8 @@ * @ingroup themeable */ #} - - + +