You are here

function potx_requirements in Translation template extractor 6.2

Same name and namespace in other branches
  1. 8 potx.install \potx_requirements()
  2. 6.3 potx.install \potx_requirements()
  3. 7.3 potx.install \potx_requirements()
  4. 7 potx.install \potx_requirements()
  5. 7.2 potx.install \potx_requirements()

Implementation of hook_requirements().

The translation template extractor requires the PHP token extension to be enabled. We should not let Drupal to install the module if this is not available. Also, if it was available, but the site was moved or PHP was changed, we should nag again: so we run in install and runtime as well.

File

./potx.install, line 16
Install requirements checking for the module.

Code

function potx_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $requirements['potx_tokenizer'] = array(
    'title' => $t('PHP tokenizer for Translation template extractor'),
    'value' => function_exists('token_get_all') ? $t('Available') : $t('Not available'),
  );
  if (!function_exists('token_get_all')) {
    $requirements['potx_tokenizer']['description'] = $t('The <a href="@tokenizer">PHP tokenizer functions</a> are required.', array(
      '@tokenizer' => 'http://php.net/tokenizer',
    ));
    $requirements['potx_tokenizer']['severity'] = REQUIREMENT_ERROR;
  }
  return $requirements;
}