You are here

public function InviteConfig::buildForm in Invite 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/InviteConfig.php, line 67

Class

InviteConfig
Class InviteConfig.

Namespace

Drupal\invite\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('invite.invite_config');
  $form['invite_expiration'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Invite Expiration'),
    '#description' => $this
      ->t('Enter the number of days before the invitation expires.'),
    '#maxlength' => 6,
    '#size' => 6,
    '#default_value' => $config
      ->get('invite_expiration'),
  ];
  $form['accept_redirect'] = [
    '#type' => 'textfield',
    '#required' => FALSE,
    '#title' => $this
      ->t('Accept Redirect'),
    '#description' => $this
      ->t('The route the user will be redirected to when registering. Defaults to "user.register"'),
    '#default_value' => $config
      ->get('accept_redirect'),
  ];
  return parent::buildForm($form, $form_state);
}