public function NameSettingsForm::buildForm in Name Field 8
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 ConfigFormBase::buildForm
File
- src/NameSettingsForm.php, line 30 
Class
- NameSettingsForm
- Configure name settings for this site.
Namespace
Drupal\nameCode
public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this->configFactory
    ->get('name.settings');
  $form['name_settings'] = [
    '#tree' => TRUE,
  ];
  $form['name_settings']['sep1'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Separator 1 replacement token'),
    '#default_value' => $config
      ->get('sep1'),
  ];
  $form['name_settings']['sep2'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Separator 2 replacement token'),
    '#default_value' => $config
      ->get('sep2'),
  ];
  $form['name_settings']['sep3'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Separator 3 replacement token'),
    '#default_value' => $config
      ->get('sep3'),
  ];
  return parent::buildForm($form, $form_state);
}