You are here

function themekey_compat_settings_form in ThemeKey 7.3

Same name and namespace in other branches
  1. 7 themekey_compat_admin.inc \themekey_compat_settings_form()
  2. 7.2 themekey_compat_admin.inc \themekey_compat_settings_form()

Form builder for the form to enable modules for ThemeKey compatibility mode.

1 string reference to 'themekey_compat_settings_form'
themekey_compat_menu in ./themekey_compat.module
Implements hook_menu().

File

./themekey_compat_admin.inc, line 16
@author Markus Kalkbrenner | bio.logis GmbH

Code

function themekey_compat_settings_form() {
  $form = array();
  $modules = module_implements('custom_theme');
  $modules = array_diff($modules, array(
    'themekey',
  ));
  $modules = array_merge($modules, variable_get('themekey_compat_modules_enabled', array()));
  asort($modules);
  if (!empty($modules)) {
    $modules_list = system_list('module_enabled');
    $options = array();
    foreach ($modules as $module) {
      $name = $module;
      if (isset($modules_list[$module]->info) && !empty($modules_list[$module]->info['name'])) {
        $name = $modules_list[$module]->info['name'] . ' (' . $modules_list[$module]->info['description'] . ')';
      }
      if ('system' == $module) {
        $name = preg_replace("/\\)\$/", ' ' . t('Provides the "Administration theme".') . ')', $name);
      }
      $options[$module] = $name;
    }
    $form['themekey_compat']['modules_enabled'] = array(
      '#type' => 'fieldset',
      '#title' => t('Modules'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    );
    $form['themekey_compat']['modules_enabled']['themekey_compat_modules_enabled'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Modules to become part of the Theme Switching Rule Chain'),
      '#description' => t("Optionally disable the theme switching capability of core and additional modules. Their theme switching capabilities will become part of ThemeKey's theme switching rule chain instead and therefor configurable."),
      '#default_value' => variable_get('themekey_compat_modules_enabled', array()),
      '#options' => $options,
    );
    $form['themekey_compat']['modules_no_default_theme'] = array(
      '#type' => 'fieldset',
      '#title' => t('No Default Theme'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['themekey_compat']['modules_no_default_theme']['themekey_compat_modules_no_default_theme'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Ignore the theme decision of these modules if they select the default theme'),
      '#default_value' => variable_get('themekey_compat_modules_no_default_theme', array()),
      '#options' => $options,
    );
    $form['buttons']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save configuration'),
    );
  }
  else {
    $form['themekey_compat']['no_module'] = array(
      '#type' => 'markup',
      '#value' => t('No different theme switching module installed.'),
    );
  }
  return $form;
}