You are here

protected function CurrencyForm::copyFormValuesToEntity in Currency 8.3

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/Currency/CurrencyForm.php, line 72

Class

CurrencyForm
Provides a currency add/edit form.

Namespace

Drupal\currency\Entity\Currency

Code

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

  /** @var \Drupal\currency\Entity\CurrencyInterface $currency */
  $currency = $entity;
  $values = $form_state
    ->getValues();
  $currency
    ->setCurrencyCode($values['currency_code']);
  $currency
    ->setCurrencyNumber($values['currency_number']);
  $currency
    ->setLabel($values['label']);
  $currency
    ->setSign($values['sign']);
  $currency
    ->setSubunits($values['subunits']);
  $currency
    ->setRoundingStep($values['rounding_step']);
  $currency
    ->setStatus($values['status']);
}