function clientside_validation_jquery_requirements in Clientside Validation 3.0.x
Same name and namespace in other branches
- 8.2 clientside_validation_jquery/clientside_validation_jquery.install \clientside_validation_jquery_requirements()
- 8 clientside_validation_jquery/clientside_validation_jquery.install \clientside_validation_jquery_requirements()
- 2.0.x clientside_validation_jquery/clientside_validation_jquery.install \clientside_validation_jquery_requirements()
Implements hook_requirements().
File
- clientside_validation_jquery/
clientside_validation_jquery.install, line 64 - Install and update hooks for clientside_validation_jquery.
Code
function clientside_validation_jquery_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
$config = \Drupal::config('clientside_validation_jquery.settings');
// We don't display any warning if specifically asked to use from CDN.
if ($config
->get('use_cdn')) {
return $requirements;
}
$library_exists = file_exists('libraries/jquery-validation/dist/jquery.validate.js');
$requirements['clientside_validation_jquery_library'] = [
'title' => t('Clientside Validation jQuery library'),
'value' => $library_exists ? t('Downloaded in Library') : t('Downloaded in module OR using from CDN'),
'description' => $library_exists ? '' : t('Check README in module folder for instructions on how to use it through libraries (Drupal way).'),
'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_WARNING,
];
}
return $requirements;
}