function vbo_export_requirements in VBO export 8
Same name and namespace in other branches
- 8.3 vbo_export.install \vbo_export_requirements()
- 8.2 vbo_export.install \vbo_export_requirements()
- 7 vbo_export.install \vbo_export_requirements()
Implements hook_requirements().
File
- ./
vbo_export.install, line 13 - Install, update and uninstall functions for the vbo_export module.
Code
function vbo_export_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$requirements['PHPExcel'] = [
'title' => t('PHPExcel library'),
];
if ($version = _vbo_export_load_library('\\PHPExcel', '/libraries/PHPExcel/Classes/PHPExcel.php', TRUE)) {
$requirements['PHPExcel']['description'] = t('Installed version: @version.', [
'@version' => $version,
]);
$requirements['PHPExcel']['severity'] = REQUIREMENT_OK;
}
else {
$url = Url::fromUri('https://github.com/PHPOffice/PHPExcel/releases');
$requirements['PHPExcel']['description'] = t('PHPExcel library is missing. To properly use export to xlsx operation, please @download and place the library files in the %directory directory or use composer: `composer require phpoffice/phpexcel`.', [
'@download' => \Drupal::l(t('download PHPExcel library'), $url),
'%directory' => '/libraries/PHPExcel',
]);
$requirements['PHPExcel']['severity'] = REQUIREMENT_WARNING;
}
}
return $requirements;
}