You are here

protected function CurrencyLocaleForm::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/CurrencyLocale/CurrencyLocaleForm.php, line 73

Class

CurrencyLocaleForm
Provides a currency_locale add/edit form.

Namespace

Drupal\currency\Entity\CurrencyLocale

Code

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

  /** @var \Drupal\currency\Entity\CurrencyLocaleInterface $currency_locale */
  $currency_locale = $entity;
  $values = $form_state
    ->getValues();
  $currency_locale
    ->setLocale($values['language_code'], $values['country_code']);
  $currency_locale
    ->setPattern($values['pattern']);
  $currency_locale
    ->setDecimalSeparator($values['decimal_separator']);
  $currency_locale
    ->setGroupingSeparator($values['grouping_separator']);
}