potx.install in Translation template extractor 8
Same filename and directory in other branches
Install requirements checking for the module.
File
potx.installView source
<?php
/**
* @file
* Install requirements checking for the module.
*/
/**
* Implements 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.
*/
function potx_requirements($phase) {
$requirements = [];
if ($phase == 'install' || $phase == 'runtime') {
$ok = function_exists('token_get_all');
$requirements['potx_tokenizer'] = [
'title' => t('PHP tokenizer for Translation template extractor'),
'value' => $ok ? t('Available') : t('Not available'),
'description' => t('The <a href="@tokenizer">PHP tokenizer functions</a> are required.', [
'@tokenizer' => 'http://php.net/tokenizer',
]),
'severity' => $ok ? REQUIREMENT_INFO : REQUIREMENT_ERROR,
];
}
return $requirements;
}
Functions
Name | Description |
---|---|
potx_requirements | Implements hook_requirements(). |