Skip to content
Snippets Groups Projects
Commit 67937250 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #910572 by sun, David_Rothstein: command line installations are broken...

- Patch #910572 by sun, David_Rothstein: command line installations are broken (programmatic form submissions don't need a theme?).
parent fc53a194
No related branches found
No related tags found
No related merge requests found
......@@ -929,38 +929,14 @@ function drupal_prepare_form($form_id, &$form, &$form_state) {
}
}
// Check theme functions for this form.
// If no #theme has been set, automatically apply theme suggestions.
// theme_form() itself is in #theme_wrappers and not #theme. Therefore, the
// #theme function only has to care for rendering the inner form elements,
// not the form itself.
drupal_theme_initialize();
$registry = theme_get_registry();
// If #theme has been set, check whether the theme function(s) exist, or
// remove the suggestion(s), so drupal_render() renders the children.
if (isset($form['#theme'])) {
if (is_array($form['#theme'])) {
foreach ($form['#theme'] as $key => $suggestion) {
if (!isset($registry[$suggestion])) {
unset($form['#theme'][$key]);
}
}
if (empty($form['#theme'])) {
unset($form['#theme']);
}
}
else {
if (!isset($registry[$form['#theme']])) {
unset($form['#theme']);
}
}
}
// Only try to auto-suggest theme functions, if #theme has not been set.
else {
if (isset($registry[$form_id])) {
$form['#theme'] = $form_id;
}
elseif (isset($form_state['build_info']['base_form_id']) && isset($registry[$form_state['build_info']['base_form_id']])) {
$form['#theme'] = $form_state['build_info']['base_form_id'];
if (!isset($form['#theme'])) {
$form['#theme'] = array($form_id);
if (isset($form_state['build_info']['base_form_id'])) {
$form['#theme'][] = $form_state['build_info']['base_form_id'];
}
}
......
......@@ -275,12 +275,12 @@ function install_begin_request(&$install_state) {
require_once DRUPAL_ROOT . '/includes/cache-install.inc';
$conf['cache_default_class'] = 'DrupalFakeCache';
// Prepare for themed output, if necessary. We need to run this at the
// beginning of the page request to avoid a different theme accidentally
// getting set.
if ($install_state['interactive']) {
drupal_maintenance_theme();
}
// Prepare for themed output. We need to run this at the beginning of the
// page request to avoid a different theme accidentally getting set. (We also
// need to run it even in the case of command-line installations, to prevent
// any code in the installer that happens to initialize the theme system from
// accessing the database before it is set up yet.)
drupal_maintenance_theme();
// Check existing settings.php.
$install_state['settings_verified'] = install_verify_settings();
......
......@@ -768,7 +768,11 @@ function theme($hook, $variables = array()) {
}
}
if (!isset($hooks[$hook])) {
watchdog('theme', 'Theme key "@key" not found.', array('@key' => $hook), WATCHDOG_WARNING);
// Only log a message when not trying theme suggestions ($hook being an
// array).
if (!isset($candidate)) {
watchdog('theme', 'Theme key "@key" not found.', array('@key' => $hook), WATCHDOG_WARNING);
}
return '';
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment