You are here

function patterns_requirements in Patterns 6

Same name and namespace in other branches
  1. 6.2 patterns.module \patterns_requirements()
  2. 7.2 patterns.install \patterns_requirements()
  3. 7 patterns.install \patterns_requirements()

Implementation of hook_requirements().

Parameters

string $phase The phase in which hook_requirements is run (install|runtime):

File

./patterns.module, line 3215
Enables extremely simple adding/removing features to your site with minimal to no configuration

Code

function patterns_requirements($phase) {
  $requirements = array();
  switch ($phase) {
    case 'runtime':
      $path = drupal_get_path('module', 'patterns') . '/spyc/spyc.php';
      if (!file_exists($path)) {
        $requirements['spyc'] = array(
          'title' => t('Spyc library (YAML parser)'),
          'description' => t('Patterns module requires Spyc library for working with YAML patterns. To enable YAML support, download the !spyc package and copy spyc.php to the spyc directory inside patterns module directory.', array(
            '!spyc' => l('spyc', 'http://code.google.com/p/spyc/', array(
              'absolute' => TRUE,
            )),
          )),
          'severity' => REQUIREMENT_WARNING,
          'value' => t('Missing'),
        );
      }
      else {
        require_once $path;
        $requirements['spyc'] = array(
          'title' => t('Spyc library (YAML parser)'),
          'severity' => REQUIREMENT_OK,
          'value' => _get_file_phpdoc_version($path),
        );
      }
      break;
  }
  return $requirements;
}