diff --git a/booking.module b/booking.module index 4703384..7945809 100644 --- a/booking.module +++ b/booking.module @@ -930,10 +930,47 @@ function booking_mail($key, &$message, $params) { } } +/** + * Implements hook_requirements(). + */ +function booking_requirements($phase) { + $requirements = array(); + $t = get_t(); + + //do a runtime verification that the stripe library is installed + if ($phase == 'runtime') { + //check that the stripe library is present + if (($library = libraries_detect('stripe')) && !empty($library['installed'])) { + // The library is installed. Awesome! + $requirements['booking_stripe_library'] = array( + 'title' => $t('Booking Module Libraries'), + 'description' => $t('Ensure that the stripe module is installed.'), + 'value' => libraries_info('stripe'), + 'severity' => REQUIREMENT_OK, + ); + } + else { + // Something went wrong. :( + // This contains a short status code of what went wrong, such as 'not found'. + //$error = $library['error']; + // This contains a detailed (localized) error message. + $error_message = $library['error message']; + $requirements['booking_stripe_library'] = array( + 'title' => $t('Booking Module Libraries'), + 'description' => $t('Ensure that the stripe module is installed.'), + 'value' => $error_message, + 'severity' => REQUIREMENT_ERROR, + ); + } + } + + return $requirements; +} /** * Function for generating the "lucky number" to be used on the lanyard + * @todo move this into a better place. It doesn't belong here */ function booking_generate_luckynumbers() { global $event; @@ -968,8 +1005,7 @@ function booking_generate_luckynumbers() { } drupal_set_message(t('Finished.')); - return t("