You are here

function opigno_module_requirements in Opigno module 8

Same name and namespace in other branches
  1. 3.x opigno_module.install \opigno_module_requirements()

Implements hook_requirements().

File

./opigno_module.install, line 295
Opigno module app install/update functionality.

Code

function opigno_module_requirements($phase) {
  $requirements = [];
  $message = t('pdf.js library is not installed. Please install it from <a href="@library">here</a> and place in <em>libraries/</em> folder', [
    '@library' => 'http://mozilla.github.io/pdf.js/getting_started/',
  ]);
  $pdf_js_library = file_exists('libraries/pdf.js/build/pdf.js') && file_exists('libraries/pdf.js/build/pdf.worker.js');
  if ($phase == 'runtime') {
    if (!$pdf_js_library) {
      $requirements += [
        'opigno_module' => [
          'title' => t('Slide activity'),
          'value' => $message,
          'severity' => REQUIREMENT_ERROR,
        ],
      ];
    }
  }
  return $requirements;
}