You are here

public function TypeStyleSettingsForm::buildForm in Type Style 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/Form/TypeStyleSettingsForm.php, line 23

Class

TypeStyleSettingsForm
Configure Type Style settings for the site.

Namespace

Drupal\type_style\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $config = $this
    ->config('type_style.settings');
  $form['icon_type'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Icon type'),
    '#options' => [
      'material' => $this
        ->t('Material Icons'),
      'fontawesome' => $this
        ->t('Font Awesome Icons'),
      'ionicons' => $this
        ->t('Ionicons'),
    ],
    '#default_value' => $config
      ->get('icon_type'),
  ];
  $form['use_cdn'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Include icon font from CDN'),
    '#default_value' => $config
      ->get('use_cdn'),
  ];
  return $form;
}