You are here

public function CoreStockEvents::saveConfigFormOptions in Commerce Stock 8

Save the configuration options.

Parameters

array $form: The stock manager configuration form holding the option elements.

\Drupal\Core\Form\FormStateInterface $form_state: The stock manager configuration form state.

Overrides StockEventsInterface::saveConfigFormOptions

File

src/Plugin/StockEvents/CoreStockEvents.php, line 88

Class

CoreStockEvents
Core Stock Events.

Namespace

Drupal\commerce_stock\Plugin\StockEvents

Code

public function saveConfigFormOptions(array $form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $config = \Drupal::configFactory()
    ->getEditable('commerce_stock.core_stock_events');
  $config
    ->set('core_stock_events_order_complete', $values['core_stock_events_order_complete']);
  $config
    ->set('core_stock_events_order_cancel', $values['core_stock_events_order_cancel']);
  $config
    ->set('core_stock_events_order_updates', $values['core_stock_events_order_updates']);
  $config
    ->save();
}