You are here

public function AlternativeFrontpageSettings::buildForm in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  2. 8.2 modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  3. 8.3 modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  4. 8.4 modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  5. 8.5 modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  6. 8.6 modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  7. 8.7 modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  8. 8.8 modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  9. 10.3.x modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  10. 10.0.x modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  11. 10.1.x modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::buildForm()
  12. 10.2.x modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php \Drupal\alternative_frontpage\Form\AlternativeFrontpageSettings::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 ConfigFormBase::buildForm

File

modules/custom/alternative_frontpage/src/Form/AlternativeFrontpageSettings.php, line 66

Class

AlternativeFrontpageSettings
Class AlternativeFrontpageSettings.

Namespace

Drupal\alternative_frontpage\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('alternative_frontpage.settings');
  $site_config = $this
    ->config('system.site');
  $form['frontpage_for_anonymous_users'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Frontpage for anonymous users'),
    '#description' => $this
      ->t('Enter the frontpage for anonymous users. This setting will override the homepage which is set in the Site Configuration form. Enter the path starting with a forward slash. Default: /stream.'),
    '#maxlength' => 64,
    '#size' => 64,
    '#default_value' => $site_config
      ->get('page.front'),
  ];
  $form['frontpage_for_authenticated_user'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Frontpage for authenticated users'),
    '#description' => $this
      ->t('Enter the frontpage for authenticated users. When the value is left empty it will use the anonymous homepage for authenticated users as well. Enter the path starting with a forward slash. Default: /stream.'),
    '#maxlength' => 64,
    '#size' => 64,
    '#default_value' => $config
      ->get('frontpage_for_authenticated_user'),
  ];
  return parent::buildForm($form, $form_state);
}