function mollie_payment_init in Mollie Payment 7.2
Implements hook_init().
File
- ./
mollie_payment.module, line 64 - Provides Mollie integration for the Payment platform.
Code
function mollie_payment_init() {
if (!drupal_is_cli() && !variable_get('mollie_payment_suppress_warnings', FALSE) && current_path() != 'admin/reports/status') {
// Prepare warning message.
$messages = array();
$message_type = 'warning';
// We need to use constants defined in includes/install.inc
require_once DRUPAL_ROOT . '/includes/install.inc';
// Load the installer.
$installer = mollie_payment_get_installer();
// Check if the Mollie API client for PHP is installed.
$result = $installer
->checkMollieApiClient();
if ($result['severity'] == REQUIREMENT_WARNING) {
$messages[] = $result['description'];
}
// Check if a default Mollie account was configured.
$result = $installer
->checkMollieAccount();
if ($result['severity'] == REQUIREMENT_WARNING) {
$messages[] = $result['description'];
}
// Check if a Mollie payment method was configured.
$result = $installer
->checkMolliePaymentMethod();
if ($result['severity'] == REQUIREMENT_WARNING) {
$messages[] = $result['description'];
}
// Combine messages.
$message = implode('<br><br>', $messages);
// Display message.
if (!empty($message)) {
// Add option to suppress warning messages.
$url = url('admin/system/mollie/warnings', array(
'query' => array(
'destination' => current_path(),
),
));
$message .= '<br><br>' . t('<a href="!url">Suppress warnings about Mollie configuration</a>.', array(
'!url' => $url,
));
drupal_set_message($message, $message_type);
}
}
}