--- customerror.module 2009-07-27 04:11:00.000000000 +0300 +++ customerror-new.module 2009-12-30 01:35:00.000000000 +0200 @@ -62,6 +62,13 @@ function customerror_admin_settings() { ) ); + $themes = system_theme_data(); + ksort($themes); + $theme_options[0] = t('System default'); + foreach ($themes as $theme) { + $theme_options[$theme->name] = $theme->name; + } + $errors = _customerror_enum_errors(); foreach($errors as $code => $desc) { if (variable_get('site_' . $code, '') != 'customerror/' . $code) { @@ -92,6 +99,13 @@ function customerror_admin_settings() { '#rows' => 10, '#description' => t('This text will be displayed if a @code (@desc) error occurs.', array('@code' => $code, '@desc' => $desc)), ); + $form[$group]['customerror_' . $code . '_theme'] = array( + '#type' => 'select', + '#options' => $theme_options, + '#title' => t('Theme'), + '#description' => t('Theme to be used on the error page.'), + '#default_value' => customerror_get_theme($code), + ); $form[$group]['customerror_' . $code . '_php'] = array( '#type' => 'checkbox', '#title' => t('Allow PHP code to be executed for @code', array( '@code' => $code)), @@ -150,6 +164,13 @@ function customerror_simpletest() { function customerror_page() { $code = arg(1); + // set custom theme for error_page if any has been selected, 0 => default + $theme = customerror_get_theme($code); + if(!empty($theme)){ + global $custom_theme; + $custom_theme = $theme; + } + switch($code) { case 403: $internal_path = substr(request_uri(), strlen(base_path())); @@ -261,3 +282,14 @@ function customerror_form_alter($form_id break; } } + +function customerror_get_theme($code = 404) { + $theme = 0; + + $admin_theme = variable_get('admin_theme', 0); + if ($admin_theme) { + $theme = variable_get('customerror_' . $code . '_theme', $admin_theme); + } + + return $theme; +} \ No newline at end of file