function tmgmt_smartling_requirements in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.2 tmgmt_smartling.module \tmgmt_smartling_requirements()
- 8.3 tmgmt_smartling.module \tmgmt_smartling_requirements()
Implements hook_requirements().
File
- ./
tmgmt_smartling.module, line 454 - Contains
Code
function tmgmt_smartling_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
$user_id = \Drupal::config('tmgmt.translator.smartling')
->get('settings.user_id');
$token_secret = \Drupal::config('tmgmt.translator.smartling')
->get('settings.token_secret');
if (empty($user_id) || empty($token_secret)) {
$missing_settings = [];
if (empty($user_id)) {
$missing_settings[] = 'User ID';
}
if (empty($token_secret)) {
$missing_settings[] = 'Token Secret';
}
$requirements['tmgmt_smartling'] = [
'title' => t('Smartling'),
'description' => t('Please set up missing settings for Smartling plugin at @page_url: @settings', [
'@page_url' => Link::fromTextAndUrl(t('Smartling provider settings page'), Url::fromUri('internal:/admin/tmgmt/translators/manage/smartling', [
'attributes' => [
'target' => '_blank',
],
]))
->toString(),
'@settings' => implode(', ', $missing_settings),
]),
'severity' => REQUIREMENT_ERROR,
];
}
// Check max execution time limit.
$current = ini_get("max_execution_time");
$recommended = 300;
if ((int) $current !== 0 && $current <= $recommended) {
$requirements['tmgmt_smartling_max_execution_time']['severity'] = REQUIREMENT_WARNING;
$requirements['tmgmt_smartling_max_execution_time']['description'] = t("Background processes might take time to be done");
$requirements['tmgmt_smartling_max_execution_time']['value'] = t("PHP max_execution_time is recommended to be set at least @recommended. Current value is @current", [
"@recommended" => $recommended,
"@current" => $current,
]);
$requirements['tmgmt_smartling_max_execution_time']['title'] = t('Smartling PHP max_execution_time');
}
}
return $requirements;
}