Skip to content

Commit d8a1240

Browse files
mglamanbojanz
authored andcommitted
Avoid WSOD when adding a new gateway (#606)
Avoid WSOD when adding a new gateway when no plugins are available
1 parent b26425d commit d8a1240

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

modules/payment/src/Form/PaymentGatewayForm.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ public static function create(ContainerInterface $container) {
3636
);
3737
}
3838

39+
/**
40+
* {@inheritdoc}
41+
*/
42+
public function buildForm(array $form, FormStateInterface $form_state) {
43+
if (empty($this->pluginManager->getDefinitions())) {
44+
$form['warning'] = [
45+
'#markup' => $this->t('No payment gateway plugins found. Please install a module which provides one.'),
46+
];
47+
return $form;
48+
}
49+
50+
return parent::buildForm($form, $form_state);
51+
}
52+
3953
/**
4054
* {@inheritdoc}
4155
*/

0 commit comments

Comments
 (0)