You are here

public function VarbaseGeneralSettingsForm::buildForm in Varbase Core 8.5

Same name and namespace in other branches
  1. 8.8 src/Form/VarbaseGeneralSettingsForm.php \Drupal\varbase_core\Form\VarbaseGeneralSettingsForm::buildForm()
  2. 8.4 src/Form/VarbaseGeneralSettingsForm.php \Drupal\varbase_core\Form\VarbaseGeneralSettingsForm::buildForm()
  3. 8.6 src/Form/VarbaseGeneralSettingsForm.php \Drupal\varbase_core\Form\VarbaseGeneralSettingsForm::buildForm()
  4. 8.7 src/Form/VarbaseGeneralSettingsForm.php \Drupal\varbase_core\Form\VarbaseGeneralSettingsForm::buildForm()
  5. 9.0.x src/Form/VarbaseGeneralSettingsForm.php \Drupal\varbase_core\Form\VarbaseGeneralSettingsForm::buildForm()

Build the form.

Overrides ConfigFormBase::buildForm

File

src/Form/VarbaseGeneralSettingsForm.php, line 30

Class

VarbaseGeneralSettingsForm
Provides form for managing module settings.

Namespace

Drupal\varbase_core\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  global $base_url;
  $front_page_with_welcome = $base_url . '/?welcome';
  $config = $this
    ->config('varbase_core.general_settings');
  $form['settings']['welcome_status'] = [
    '#type' => 'checkbox',
    '#default_value' => $config
      ->get('welcome_status'),
    '#title' => t('Allow site to show welcome message'),
    '#description' => t('This option will allow to display Varbase\'s welcome message on the homepage by adding <code>?welcome</code> to the URL. This option is automatically disabled after closing the welcome message. Check this then navigate to <a href="@front_page_with_welcome">@front_page_with_welcome</a> to see the welcome message again.', [
      '@front_page_with_welcome' => $front_page_with_welcome,
    ]),
  ];
  return parent::buildForm($form, $form_state);
}