diff --git a/src/Form/AdminSettingsForm.php b/src/Form/AdminSettingsForm.php index 6f7df91..b8f5352 100644 --- a/src/Form/AdminSettingsForm.php +++ b/src/Form/AdminSettingsForm.php @@ -5,6 +5,9 @@ namespace Drupal\pricespider\Form; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; +/** + * The Price Spider Configuration Form. + */ class AdminSettingsForm extends ConfigFormBase { /** @@ -18,7 +21,7 @@ class AdminSettingsForm extends ConfigFormBase { * {@inheritdoc} */ protected function getEditableConfigNames() { - return ['pricespider.settings']; + return ['pricespider.settings']; } /** @@ -39,7 +42,7 @@ class AdminSettingsForm extends ConfigFormBase { '#title' => $this->t('Account Number'), '#description' => $this->t('Account Number (value placed in the ps-account metatag)'), '#default_value' => $config->get('ps.account'), - '#required' => TRUE, + '#required' => FALSE, ]; $form['metatags']['ps_config'] = [ @@ -47,7 +50,7 @@ class AdminSettingsForm extends ConfigFormBase { '#title' => $this->t('Config ID'), '#description' => $this->t('Configuration ID (value placed in the ps-config metatag)'), '#default_value' => $config->get('ps.config'), - '#required' => TRUE, + '#required' => FALSE, ]; $form['metatags']['ps_key'] = [ @@ -62,7 +65,7 @@ class AdminSettingsForm extends ConfigFormBase { '#type' => 'textfield', '#title' => $this->t('CDN Javascript File'), '#description' => $this->t('Path to Price Spider hosted Javascript file. (example: //cdn.pricespider.com/1/lib/ps-widget.js)'), - '#default_value' => $config->get('ps.js', '//cdn.pricespider.com/1/lib/ps-widget.js'), + '#default_value' => $config->get('ps.js'), '#required' => TRUE, ]; @@ -75,19 +78,21 @@ class AdminSettingsForm extends ConfigFormBase { $form['wtb']['wtb_uri'] = [ '#type' => 'textfield', '#title' => $this->t('Where To Buy page url'), - '#description' > $this->t('Location of where the Where to Buy page should live. Leave of trailing slashes.'), - '#default_value' => $config->get('wtb.uri', 'where-to-buy'), + '#description' => $this->t('Location of where the Where to Buy page should live. Leave off trailing slashes.'), + '#default_value' => $config->get('wtb.uri'), ]; return parent::buildForm($form, $form_state); } + /** + * {@inheritdoc} + */ public function submitForm(array &$form, FormStateInterface $form_state) { - $values = $form_state->getValues(); $this->config('pricespider.settings') - ->set('ps.account',$values['ps_account']) + ->set('ps.account', $values['ps_account']) ->set('ps.config', $values['ps_config']) ->set('ps.key', $values['ps_key']) ->set('ps.js', $values['ps_js']) @@ -95,4 +100,5 @@ class AdminSettingsForm extends ConfigFormBase { ->save(); parent::submitForm($form, $form_state); } -} \ No newline at end of file + +}