diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 0794b3d..2caf6da 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1070,7 +1070,7 @@ function theme($hook, $variables = array()) { // array. foreach (array('preprocess functions', 'process functions') as $processor) { if (isset($base_hook_info[$processor])) { - $info = array_merge($info, array($processor => $base_hook_info[$processor])); + $info[$processor] = $base_hook_info[$processor]; } } } diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockPreprocessUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockPreprocessUnitTest.php new file mode 100644 index 0000000..ddbc40c --- /dev/null +++ b/core/modules/block/lib/Drupal/block/Tests/BlockPreprocessUnitTest.php @@ -0,0 +1,56 @@ + 'Block preprocess', + 'description' => 'Test the template_preprocess_block() function.', + 'group' => 'Block', + ); + } + + /** + * Tests block classes with template_preprocess_block(). + */ + function testBlockClasses() { + // Define a block with a derivative to be preprocessed, which includes both + // an underscore (not transformed) and a hyphen (transformed to underscore), + // and generates possibilities for each level of derivative. + // @todo Clarify this comment. + $block = entity_create('block', array( + 'plugin' => 'system_menu_block:menu-admin', + 'region' => 'footer', + 'id' => config('system.theme')->get('default') . '.machinename', + )); + + $variables = array(); + $variables['elements']['#block'] = $block; + $variables['elements']['#configuration'] = $block->getPlugin()->getConfig(); + $variables['elements']['#plugin_id'] = $block->get('plugin'); + $variables['elements']['content'] = array(); + $variables['content_attributes']['class'][] = 'test-class'; + template_preprocess_block($variables); + $this->assertEqual($variables['content_attributes']['class'], array('test-class', 'content'), 'Default .content class added to block content_attributes'); + } + +} diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 39e685e..767b499 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1038,7 +1038,15 @@ function system_theme_suggestions_page_alter(array &$suggestions, array $variabl function system_theme_suggestions_maintenance_page_alter(array &$suggestions, array $variables) { // Dead databases will show error messages so supplying this template will // allow themers to override the page and the content completely. - if (defined('MAINTENANCE_MODE')) { + $offline = defined('MAINTENANCE_MODE'); + try { + drupal_is_front_page(); + } + catch (Exception $e) { + // The database is not yet available. + $offline = TRUE; + } + if ($offline) { $suggestions[] = 'maintenance_page__offline'; } }