You are here

function role_theme_switcher_admin_settings in Role Theme Switcher 7

Same name and namespace in other branches
  1. 5.2 role_theme_switcher.module \role_theme_switcher_admin_settings()
  2. 6 role_theme_switcher.module \role_theme_switcher_admin_settings()

Implementation of hook_settings()

1 string reference to 'role_theme_switcher_admin_settings'
role_theme_switcher_menu in ./role_theme_switcher.module
Implementation of hook_menu()

File

./role_theme_switcher.module, line 44

Code

function role_theme_switcher_admin_settings() {
  $roles = user_roles();

  // Get all themes
  $themes = list_themes();
  $themes_list = array(
    'Default',
  );
  foreach ($themes as $theme_name => $theme) {
    if (drupal_theme_access($theme)) {
      $themes_list[] = $theme_name;
    }
  }
  foreach ($roles as $id => $role) {
    $form['role_theme_switcher_' . $id . '_theme'] = array(
      '#type' => 'select',
      '#title' => drupal_ucfirst(drupal_strtolower($role)),
      '#options' => drupal_map_assoc($themes_list),
      '#default_value' => variable_get('role_theme_switcher_' . $id . '_theme', ''),
    );
  }
  $form['hint'] = array(
    '#markup' => t('Only enabled themes are shown. You can manage themes in') . ' ' . l('Appearance', 'admin/appearance') . ' ' . t('section'),
  );
  return system_settings_form($form);
}