From 0b2828b3ea0790e4fa0e02ca41f53b7525ea6f86 Mon Sep 17 00:00:00 2001 From: Bruno Massa <brmassa@67164.no-reply.drupal.org> Date: Tue, 11 Mar 2008 14:15:23 +0000 Subject: [PATCH] New features: * implementation of hook_requirements() to alert users that he/she didnt installed any chart provider module --- charts.module | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/charts.module b/charts.module index 34c0de4..a0e4bbe 100644 --- a/charts.module +++ b/charts.module @@ -24,7 +24,7 @@ */ function charts_chart($chart_provider, &$data) { if (function_exists()) { - $chart_provider = $chart_provider .'_printchart'; + $chart_provider = $chart_provider .'_chartapi'; return $chart_provider($data); } } @@ -52,4 +52,18 @@ function charts_menu() { 'type' => MENU_LOCAL_TASK, ); return $items; -} \ No newline at end of file +} + +/** + * Implementation of hook_requirements(). + */ +function charts_requirements($phase) { + if ($phase == 'runtime' and !$modules = module_invoke_all('chartsinfo', 'list')) { + $requirements['charts']['title'] = t('Charts'); + $requirements['charts']['value'] = t('No Charts provider installed'); + $requirements['charts']['severity'] = REQUIREMENT_ERROR; + $requirements['charts']['description'] = t('Charts core module only provides a a common set of functions. You must install a Charts provider module to create charts.'); + + return $requirements; + } +} -- GitLab