public function UserPointsTransactor::submitConfigurationForm in User Points 8
Handles the settings form submit for this transactor plugin.
Parameters
array $form: The form array.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
Overrides TransactorBase::submitConfigurationForm
File
- src/
Plugin/ Transaction/ UserPointsTransactor.php, line 166
Class
- UserPointsTransactor
- Transactor for user points type transactions.
Namespace
Drupal\userpoints\Plugin\TransactionCode
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
// Add roles to plugin settings settings.
$roles = [];
foreach ($form_state
->getValue('roles') as $role) {
if (!empty($role)) {
$roles[] = $role;
}
}
/** @var \Drupal\transaction\TransactionTypeInterface $transaction_type */
$transaction_type = $form_state
->getFormObject()
->getEntity();
$settings = $transaction_type
->getPluginSettings();
$settings['roles'] = implode(',', $roles);
$transaction_type
->setPluginSettings($settings);
return parent::submitConfigurationForm($form, $form_state);
}