You are here

public function CoreStockEvents::configFormOptions in Commerce Stock 8

Return form elements holding the configuration options.

Overrides StockEventsInterface::configFormOptions

File

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

Class

CoreStockEvents
Core Stock Events.

Namespace

Drupal\commerce_stock\Plugin\StockEvents

Code

public function configFormOptions() {
  $config = \Drupal::configFactory()
    ->get('commerce_stock.core_stock_events');
  $form_options['core_stock_events_order_complete'] = [
    '#type' => 'checkbox',
    '#title' => t('Reserve stock on order complete'),
    '#default_value' => $config
      ->get('core_stock_events_order_complete'),
  ];
  $form_options['core_stock_events_order_cancel'] = [
    '#type' => 'checkbox',
    '#title' => t('Automatically return stock on cancel'),
    '#default_value' => $config
      ->get('core_stock_events_order_cancel'),
  ];
  $form_options['core_stock_events_order_updates'] = [
    '#type' => 'checkbox',
    '#title' => t('Adjust stock on order updates (after the order was completed)'),
    '#default_value' => $config
      ->get('core_stock_events_order_updates'),
  ];
  return $form_options;
}