如何让 Ajax 在 SimpleNews 模块的订阅块中发送订阅?
我这样做,但它不起作用。
function simpleNewsAlter_simplenews_subscriptions_block_ico_subscription_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
$form['system_messages'] = [
'#markup' => '<div id="' . Html::getClass($form_id) . '-messages"></div>',
'#weight' => -100,
];
$form['actions']['subscribe']['#ajax'] = [
'callback' => '\Drupal\simplenews\Form\SubscriptionsBlockForm::submitSubscribe',
'event' => 'click',
'progress' => [
'type' => 'throbber',
],
];
}