public function AccountSettingsForm::submitForm in Optimizely 8
Same name and namespace in other branches
- 8.0 src/AccountSettingsForm.php \Drupal\optimizely\AccountSettingsForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
AccountSettingsForm.php, line 62
Class
- AccountSettingsForm
- Implements the form for Account Info.
Namespace
Drupal\optimizelyCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Store the optimizely account id number.
$optimizely_id = $form_state
->getValue('optimizely_id');
AccountId::setId($optimizely_id);
// Update the default project / experiment entry with the account ID value.
\Drupal::database()
->update('optimizely')
->fields([
'project_code' => $optimizely_id,
])
->condition('oid', '1')
->execute();
// Inform the administrator that the default project / experiment entry
// is ready to be enabled.
drupal_set_message(t('The default project entry is now ready to be enabled.
This will apply the default Optimizely project tests sitewide.'), 'status');
// Redirect back to projects listing.
$form_state
->setRedirect('optimizely.listing');
}