public function AccountSettingsForm::buildForm in Optimizely 8
Same name and namespace in other branches
- 8.0 src/AccountSettingsForm.php \Drupal\optimizely\AccountSettingsForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- src/
AccountSettingsForm.php, line 23
Class
- AccountSettingsForm
- Implements the form for Account Info.
Namespace
Drupal\optimizelyCode
public function buildForm(array $form, FormStateInterface $form_state) {
$settings_form['#theme'] = 'optimizely_account_settings_form';
$form['#attached']['library'][] = 'optimizely/optimizely.forms';
$settings_form['optimizely_id'] = [
'#type' => 'textfield',
'#title' => $this
->t('Optimizely ID Number'),
'#default_value' => AccountId::getId(),
'#description' => $this
->t('Your Optimizely account ID. This is the number after "/js/" in the
Optimizely Tracking Code found in your account on the Optimizely website.'),
'#size' => 60,
'#maxlength' => 256,
'#required' => TRUE,
];
$settings_form['actions'] = [
'#type' => 'actions',
];
$settings_form['actions']['submit'] = [
'#type' => 'submit',
'#value' => 'Submit',
];
// Will be $form in the render array and the template file.
return $settings_form;
}