You are here

public function SocialUserNavigationSettingsForm::buildForm in Open Social 8

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

Class

SocialUserNavigationSettingsForm
Class SocialUserNavigationSettingsForm.

Namespace

Drupal\social_user\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  // Get the configuration file.
  $config = $this
    ->config('social_user.navigation.settings');
  $form['navigation_settings'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Display icon configuration'),
    '#description' => $this
      ->t('Select which icons you want to show or hide in the main (top) navigation bar.'),
  ];

  // Check if the module is enabled before we show the setting.
  if ($this->moduleHandler
    ->moduleExists('social_private_message')) {
    $form['navigation_settings']['display_social_private_message_icon'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Display the <b>Social Private Message</b> (envelope) icon.'),
      '#default_value' => $config
        ->get('display_social_private_message_icon'),
      '#required' => FALSE,
      '#description' => $this
        ->t("<i>Disabling this won't disable the Social Private Message feature, but only hide the icon from the navigation.</i>"),
    ];
  }

  // Check if the module is enabled before we show the setting.
  if ($this->moduleHandler
    ->moduleExists('social_group')) {
    $form['navigation_settings']['display_my_groups_icon'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Display the <b>My Groups</b> icon in the main navigation'),
      '#default_value' => $config
        ->get('display_my_groups_icon'),
      '#required' => FALSE,
      '#description' => $this
        ->t("<i>Disabling this will simply hide the 'My Groups' button from the main navigation.</i>"),
    ];
  }
  return parent::buildForm($form, $form_state);
}