You are here

function charts_chartjs_requirements in Charts 5.0.x

Implements hook_requirements().

File

modules/charts_chartjs/charts_chartjs.install, line 10
Installation and uninstallation functions.

Code

function charts_chartjs_requirements($phase) {
  $requirements = [];
  switch ($phase) {
    case 'runtime':
      $library_path = charts_chartjs_find_library();
      if (!$library_path) {
        $requirements['charts_chartjs_js'] = [
          'title' => t('Chart.js Library'),
          'value' => t('Not Installed'),
          'severity' => REQUIREMENT_ERROR,
          'description' => t('You are missing the Chart.js library in your Drupal installation directory. Please see the README file inside charts_chartjs for instructions to install the library.'),
        ];
      }
      else {
        $requirements['charts_chartjs_js'] = [
          'title' => t('Chart.js Library'),
          'severity' => REQUIREMENT_OK,
          'value' => t('Installed'),
        ];
      }
      break;
  }
  return $requirements;
}