You are here

public function IntervalBase::submitConfigurationForm in Commerce Recurring Framework 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides BillingScheduleBase::submitConfigurationForm

1 call to IntervalBase::submitConfigurationForm()
Fixed::submitConfigurationForm in src/Plugin/Commerce/BillingSchedule/Fixed.php
Form submission handler.
1 method overrides IntervalBase::submitConfigurationForm()
Fixed::submitConfigurationForm in src/Plugin/Commerce/BillingSchedule/Fixed.php
Form submission handler.

File

src/Plugin/Commerce/BillingSchedule/IntervalBase.php, line 122

Class

IntervalBase
Base class for interval-based billing schedules.

Namespace

Drupal\commerce_recurring\Plugin\Commerce\BillingSchedule

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::submitConfigurationForm($form, $form_state);
  if (!$form_state
    ->getErrors()) {
    $values = $form_state
      ->getValue($form['#parents']);
    $this->configuration = [];
    $this->configuration['trial_interval'] = [];
    if (!empty($values['trial_interval']['allow_trials'])) {
      $this->configuration['trial_interval'] = [
        'number' => $values['trial_interval']['number'],
        'unit' => $values['trial_interval']['unit'],
      ];
    }
    $this->configuration['interval'] = $values['interval'];
  }
}