public function MolliePaymentInstaller::checkMolliePaymentMethod in Mollie Payment 7.2
Checks if a Mollie payment method has been defined for the Payment module.
Return value
array An associative array as expected by hook_requirements().
File
- includes/
mollie_payment.installer.inc, line 146
Class
- MolliePaymentInstaller
- Class MolliePaymentInstaller.
Namespace
Drupal\mollie_paymentCode
public function checkMolliePaymentMethod() {
$value = 'no payment method';
$description = t('There is no Payment method configured for Mollie.');
$severity = REQUIREMENT_WARNING;
// Load payment methods.
$methods = entity_load('payment_method', FALSE, array(
'controller_class_name' => MolliePaymentMethodController::class,
));
if (!empty($methods)) {
$value = 'ok';
$description = t('There is at least one Mollie payment method configured.');
$severity = REQUIREMENT_OK;
}
if ($severity === REQUIREMENT_WARNING) {
// Add a link to the form to add a Mollie payment method.
$description .= ' ' . t('Click to <a href="!url">add a Mollie payment method</a>.', [
'!url' => url('admin/config/services/payment/method/add/' . MolliePaymentMethodController::class, [
'query' => [
'destination' => current_path(),
],
]),
]);
}
return $this
->formatRequirements('Mollie payment method', $value, $description, $severity);
}