Skip to content

Commit

Permalink
[#494] Add multiple_products field to config form (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadcn authored Oct 13, 2020
1 parent c4ccce7 commit 31d59cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Form/AppSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#open' => TRUE,
];

$form['api_product']['multiple_products'] = [
'#type' => 'checkbox',
'#title' => $this->t('Allow multiple products'),
'#description' => $this->t('Allow users to select multiple products.'),
'#default_value' => $common_app_settings->get('multiple_products'),
];

$form['api_product']['display_as_select'] = [
'#type' => 'checkbox',
'#title' => $this->t('Display the API Product widget as a select box (instead of checkboxes/radios)'),
Expand Down Expand Up @@ -198,6 +205,7 @@ public function apiProductListCallback(array &$form, FormStateInterface $form_st
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('apigee_edge.common_app_settings')
->set('multiple_products', $form_state->getValue('multiple_products'))
->set('display_as_select', $form_state->getValue('display_as_select'))
->set('user_select', $form_state->getValue('user_select'))
->set('default_products', array_values(array_filter($form_state->getValue('default_api_product_multiple'))))
Expand Down

0 comments on commit 31d59cb

Please sign in to comment.