You are here

public function MentionsSettingsForm::buildForm in Open Social 8.5

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

Class

MentionsSettingsForm
Configure mentions settings.

Namespace

Drupal\mentions\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('mentions.settings');
  $form['general'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('General configuration'),
    '#open' => TRUE,
  ];
  $form['general']['supported_entity_types'] = [
    '#title' => $this
      ->t('Supported entity types'),
    '#type' => 'select',
    '#multiple' => TRUE,
    '#options' => $this
      ->getContentEntityTypes(),
    '#default_value' => $config
      ->get('supported_entity_types'),
    '#description' => $this
      ->t('Mentions entity will be created only for selected entity types.'),
  ];
  $form['general']['suggestions_amount'] = [
    '#title' => $this
      ->t('Number of suggestions'),
    '#type' => 'number',
    '#default_value' => $config
      ->get('suggestions_amount'),
    '#description' => $this
      ->t('How many suggestions do you want to show when mentioning.'),
    '#min' => 0,
    '#max' => 100,
  ];
  return parent::buildForm($form, $form_state);
}