/**
  * {@inheritdoc}
  */
 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($payment_method_configuration_plugin instanceof ConfigurablePluginInterface ? $payment_method_configuration_plugin->getConfiguration() : []);
 }
 /**
  * {@inheritdoc}
  */
 protected function copyFormValuesToEntity(EntityInterface $payment_status, array $form, FormStateInterface $form_state)
 {
     /** @var \Drupal\payment\Entity\PaymentStatusInterface $payment_status */
     parent::copyFormValuesToEntity($payment_status, $form, $form_state);
     $values = $form_state->getValues();
     $payment_status->setId($values['id']);
     $payment_status->setLabel($values['label']);
     $selected_parent = $this->getParentPaymentStatusSelector($form_state)->getSelectedPlugin();
     $payment_status->setParentId($selected_parent ? $selected_parent->getPluginId() : NULL);
     $payment_status->setDescription($values['description']);
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state)
 {
     /** @var \Drupal\media_entity\MediaBundleInterface $entity */
     parent::copyFormValuesToEntity($entity, $form, $form_state);
     // Use type configuration for the plugin that was chosen.
     $configuration = $form_state->getValue('type_configuration');
     $configuration = empty($configuration[$entity->getType()->getPluginId()]) ? [] : $configuration[$entity->getType()->getPluginId()];
     $entity->set('type_configuration', $configuration);
 }