protected function PaymentMethodConfigurationForm::copyFormValuesToEntity in Payment 8.2
Copies top-level form values to entity properties
This should not change existing entity properties that are not being edited by this form.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the current form should operate upon.
array $form: A nested array of form elements comprising the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides EntityForm::copyFormValuesToEntity
File
- src/
Entity/ PaymentMethodConfiguration/ PaymentMethodConfigurationForm.php, line 147
Class
- PaymentMethodConfigurationForm
- Provides the payment method configuration form.
Namespace
Drupal\payment\Entity\PaymentMethodConfigurationCode
protected function copyFormValuesToEntity(EntityInterface $payment_method_configuration, array $form, FormStateInterface $form_state) {
/** @var \Drupal\payment\Entity\PaymentMethodConfigurationInterface $payment_method_configuration */
parent::copyFormValuesToEntity($payment_method_configuration, $form, $form_state);
$values = $form_state
->getValues();
/** @var \Drupal\payment\Plugin\Payment\MethodConfiguration\PaymentMethodConfigurationInterface $payment_method_configuration_plugin */
$payment_method_configuration_plugin = $form_state
->get('payment_method_configuration');
$payment_method_configuration
->setLabel($values['label']);
$payment_method_configuration
->setStatus($values['status']);
$payment_method_configuration
->setOwnerId($values['owner']);
$payment_method_configuration
->setPluginConfiguration(PluginHelper::isConfigurable($payment_method_configuration_plugin) ? $payment_method_configuration_plugin
->getConfiguration() : []);
}