Skip to content
Snippets Groups Projects
Commit af14651c authored by Steven Ayers's avatar Steven Ayers
Browse files

Issue #2545108: D7 Allow custom theme for /visitors path

parent c0db1ac6
Branches
Tags
2 merge requests!53Issue #3310771: 7.x-2.0-alpha10,!29Issue #2545108: D7 Allow custom theme for /visitors path
......@@ -170,5 +170,21 @@ function visitors_admin_settings() {
'#description' => t('Chart height.'),
);
$installed = array_filter(list_themes(), function ($obj) {
return $obj->status;
});
$themes = array('_admin' => t('admin'), '_default' => t('default')) + array_map(function ($value) {
return $value->name;
}, $installed);
$form['visitors_theme'] = array(
'#title' => t('Theme'),
'#description' => t('Select a theme for the Visitors reports.'),
'#type' => 'select',
'#options' => $themes,
'#default_value' => variable_get('visitors_theme', '_admin'),
);
return system_settings_form($form);
}
......@@ -409,3 +409,30 @@ function visitors_sqlite_date_format_sql($field_name, $format) {
}
return $result;
}
/**
* Implements hook_custom_theme().
*/
function visitors_custom_theme() {
if (arg(0) == 'visitors') {
$theme = variable_get('visitors_theme', '_admin');
if ($theme == '_admin') {
$admin_theme = variable_get('admin_theme', 0);
if ($admin_theme) {
return $admin_theme;
}
}
if ($theme != '_default') {
$installed = array_filter(list_themes(), function ($obj) {
return $obj->status;
});
$installed_themes = array_keys($installed);
if (in_array($theme, $installed_themes)) {
return $theme;
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment