? .project
? 591794.patch
? sites/all/modules/devel
? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1009
diff -u -p -r1.1009 common.inc
--- includes/common.inc	9 Oct 2009 00:59:54 -0000	1.1009
+++ includes/common.inc	9 Oct 2009 07:19:06 -0000
@@ -4254,6 +4254,30 @@ function drupal_alter($type, &$data) {
     $function = $module . '_' . $type . '_alter';
     call_user_func_array($function, $args);
   }
+
+  // Expose selected alterations to the theme layer. Only the following
+  // alterations are applied as others are called too early for the theme layer
+  // to be initialized.
+  switch ($type) {
+    case 'js':
+    case 'library':
+    case 'css':
+    case 'page':
+    case 'form_' . substr($type, 5):
+      drupal_theme_initialize();
+      global $theme, $base_theme;
+      $themes = array($theme);
+      foreach ($base_theme as $base) {
+        $themes[] = $base->name;
+      }
+      foreach ($themes as $base) {
+        $function = $base . '_' . $type . '_alter';
+        if (function_exists($function)) {
+          call_user_func_array($function, $args);
+        }
+      }
+      break;
+  }
 }
 
 /**
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.532
diff -u -p -r1.532 theme.inc
--- includes/theme.inc	9 Oct 2009 00:59:54 -0000	1.532
+++ includes/theme.inc	9 Oct 2009 07:19:14 -0000
@@ -55,7 +55,7 @@ function drupal_theme_access($theme) {
  * Initialize the theme system by loading the theme.
  */
 function drupal_theme_initialize() {
-  global $theme, $user, $theme_key;
+  global $theme, $user, $theme_key, $base_theme;
 
   // If $theme is already set, assume the others are set, too, and do nothing
   if (isset($theme)) {
@@ -84,7 +84,8 @@ function drupal_theme_initialize() {
     $base_theme[] = $new_base_theme = $themes[$themes[$ancestor]->base_theme];
     $ancestor = $themes[$ancestor]->base_theme;
   }
-  _drupal_theme_initialize($themes[$theme], array_reverse($base_theme));
+  $base_theme = array_reverse($base_theme);
+  _drupal_theme_initialize($themes[$theme], $base_theme);
 }
 
 /**
Index: includes/theme.maintenance.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v
retrieving revision 1.42
diff -u -p -r1.42 theme.maintenance.inc
--- includes/theme.maintenance.inc	9 Oct 2009 00:59:54 -0000	1.42
+++ includes/theme.maintenance.inc	9 Oct 2009 07:19:14 -0000
@@ -15,7 +15,7 @@
  * $conf variable in order to change the maintenance theme.
  */
 function _drupal_maintenance_theme() {
-  global $theme, $theme_key;
+  global $theme, $theme_key, $base_theme;
 
   // If $theme is already set, assume the others are set too, and do nothing.
   if (isset($theme)) {
@@ -30,6 +30,7 @@ function _drupal_maintenance_theme() {
   require_once DRUPAL_ROOT . '/includes/module.inc';
   require_once DRUPAL_ROOT . '/includes/database/database.inc';
   unicode_check();
+  $base_theme = array();
 
   // Install and update pages are treated differently to prevent theming overrides.
   if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) {
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.81
diff -u -p -r1.81 common.test
--- modules/simpletest/tests/common.test	8 Oct 2009 07:58:46 -0000	1.81
+++ modules/simpletest/tests/common.test	9 Oct 2009 07:19:22 -0000
@@ -1527,6 +1527,33 @@ class FormatDateUnitTest extends DrupalW
 }
 
 /**
+ * Tests exposing selective alterations to the theme layer via drupal_alter().
+ */
+class DrupalAlterThemeTest extends DrupalWebTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Drupal theme alterations',
+      'description' => 'Test the ability for themes to alter objects through drupal_alter().',
+      'group' => 'System',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('common_test');
+  }
+
+  /**
+   * Test that the form description we add appears.
+   */
+  function testFormCleanId() {
+    $this->drupalGet('common-test/theme_form_alter');
+    $this->assertText('This description has been altered.');
+  }
+
+}
+
+/**
  * Tests for the format_date() function.
  */
 class DrupalAttributesUnitTest extends DrupalUnitTestCase {
Index: modules/simpletest/tests/common_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common_test.module,v
retrieving revision 1.4
diff -u -p -r1.4 common_test.module
--- modules/simpletest/tests/common_test.module	9 Oct 2009 01:00:03 -0000	1.4
+++ modules/simpletest/tests/common_test.module	9 Oct 2009 07:19:22 -0000
@@ -36,10 +36,37 @@ function common_test_menu() {
     'access arguments' => array('access content'),
     'type' => MENU_CALLBACK,
   );
+  $items['common-test/theme_form_alter'] = array(
+    'title' => 'Form alter from the theme test',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('common_test_theme_form_alter'),
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
   return $items;
 }
 
 /**
+ * Page callback for the form alter themes test.
+ */
+function common_test_theme_form_alter($form, &$form_state) {
+  $form['input'] = array(
+    '#type' => 'textfield',
+    '#title' => 'Input',
+    '#description' => 'This description is not altered.',
+    '#required' => TRUE,
+  );
+  return $form;
+}
+
+/**
+ * Implement a hook_form_alter in the name of Garland.
+ */
+function garland_form_common_test_theme_form_alter_alter(&$form) {
+  $form['input']['#description'] = 'This description has been altered.';
+}
+
+/**
  * Check that drupal_goto() exits once called.
  */
 function common_test_drupal_goto_redirect() {
? sites/all/modules/yahoopipes/.project
