You are here

protected function MollieProfileForm::copyFormValuesToEntity in Mollie 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/MollieProfile/MollieProfileForm.php, line 121

Class

MollieProfileForm
Provides the Mollie profile add/edit form.

Namespace

Drupal\mollie_payment\Entity\MollieProfile

Code

protected function copyFormValuesToEntity(EntityInterface $mollie_profile, array $form, FormStateInterface $form_state) {

  /** @var \Drupal\mollie_payment\Entity\MolliePaymentInterface $mollie_profile */
  parent::copyFormValuesToEntity($mollie_profile, $form, $form_state);
  $values = $form_state
    ->getValues();
  $mollie_profile
    ->setId($values['id']);
  $mollie_profile
    ->setLabel($values['label']);
  $mollie_profile
    ->setApiKey($values['apiKey']);
}