You are here

function vbo_export_requirements in VBO export 8.3

Same name and namespace in other branches
  1. 8 vbo_export.install \vbo_export_requirements()
  2. 8.2 vbo_export.install \vbo_export_requirements()
  3. 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 = [];
  if ($phase == 'runtime') {
    $requirements['PhpSpreadsheet'] = [
      'title' => t('PhpSpreadsheet library'),
    ];
    if ($version = _vbo_export_library_exists(Spreadsheet::class, TRUE)) {
      $requirements['PhpSpreadsheet']['description'] = t('Installed version: @version.', [
        '@version' => $version,
      ]);
      $requirements['PhpSpreadsheet']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['PhpSpreadsheet']['description'] = t('PhpSpreadsheet library is missing. To properly use export to xlsx operation, please use composer: `composer require phpoffice/phpspreadsheet`.');
      $requirements['PHPExcel']['severity'] = REQUIREMENT_WARNING;
    }
  }
  return $requirements;
}