You are here

function themekey_requirements in ThemeKey 7.3

Implements hook_requirements().

File

./themekey.install, line 115
Database schema of

Code

function themekey_requirements($phase) {
  $requirements = array();
  $t = get_t();
  switch ($phase) {
    case 'update':
      if (module_exists('domain_theme') && !module_exists('domain_themekey')) {
        $requirements['domain_themekey_warning'] = array(
          'title' => $t('Domain ThemeKey'),
          'description' => $t('You enabled the Domain Theme module. To ensure the its compatibility to ThemeKey its required to additionally install and enable the !module_link sub-module before you proceed.', array(
            '!module_link' => l('Domain ThemeKey', 'https://www.drupal.org/project/domain_themekey'),
          )),
          'value' => $t('Not installed'),
          'severity' => REQUIREMENT_ERROR,
        );
      }
      break;
    case 'runtime':

      // If Domain ThemeKey is disabled or uninstalled but ThemeKey
      // holds Domain ThemeKey properties then error message needed.
      if (!module_exists('domain_themekey')) {
        $themekey_properties = db_select('themekey_properties', 'tp')
          ->fields('tp')
          ->condition('tp.enabled', 1)
          ->condition('tp.property', db_like('domain:') . '%', 'LIKE')
          ->execute()
          ->fetchAll();
        if (count($themekey_properties) > 0) {
          $requirements['domain_themekey_error'] = array(
            'title' => $t('Domain ThemeKey'),
            'description' => $t('Your rule chain contains properties provided by the !module_link sub-module. You have to enable it to get your chain to work correctly.', array(
              '!module_link' => l('Domain ThemeKey', 'https://www.drupal.org/project/domain_themekey'),
            )),
            'value' => $t('Not installed'),
            'severity' => REQUIREMENT_WARNING,
          );
        }
      }
      break;
  }
  return $requirements;
}