public function TeamInvitationForm::buildForm in Apigee Edge 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
- modules/
apigee_edge_teams/ src/ Form/ TeamInvitationForm.php, line 49
Class
- TeamInvitationForm
- Provides settings form for team_invitation..
Namespace
Drupal\apigee_edge_teams\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('apigee_edge_teams.team_settings');
$form['team_invitation_expiry_days'] = [
'#type' => 'number',
'#title' => $this
->t('Expiry days'),
'#description' => $this
->t('Number of days before team invitations are expired.'),
'#required' => TRUE,
'#default_value' => $config
->get('team_invitation_expiry_days'),
];
$form['email_for_existing_users'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Invitation email for existing users'),
'#collapsible' => FALSE,
];
$form['email_for_existing_users']['team_invitation_email_existing_subject'] = [
'#title' => $this
->t('Subject'),
'#type' => 'textfield',
'#required' => TRUE,
'#default_value' => $config
->get('team_invitation_email_existing.subject'),
];
$form['email_for_existing_users']['team_invitation_email_existing_body'] = [
'#title' => $this
->t('Body'),
'#type' => 'textarea',
'#rows' => 10,
'#required' => TRUE,
'#default_value' => $config
->get('team_invitation_email_existing.body'),
'#description' => $this
->t('Available tokens: [user:display-name], [site:name], [site:url], [team_invitation:team_name], [team_invitation:url_accept], [team_invitation:url_decline], [team_invitation:uid:entity:display-name] (the display name of the user who sent the invitation) and [team_invitation:expiry_days]'),
];
$form['email_for_new_users'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Invitation email for new users'),
'#collapsible' => FALSE,
];
$form['email_for_new_users']['team_invitation_email_new_subject'] = [
'#title' => $this
->t('Subject'),
'#type' => 'textfield',
'#required' => TRUE,
'#default_value' => $config
->get('team_invitation_email_new.subject'),
];
$form['email_for_new_users']['team_invitation_email_new_body'] = [
'#title' => $this
->t('Body'),
'#type' => 'textarea',
'#rows' => 10,
'#required' => TRUE,
'#default_value' => $config
->get('team_invitation_email_new.body'),
'#description' => $this
->t('Available tokens: [site:name], [site:url], [team_invitation:team_name], [team_invitation:url_register], [team_invitation:url_accept], [team_invitation:url_decline], [team_invitation:uid:entity:display-name] (the display name of the user who sent the invitation) and [team_invitation:expiry_days].'),
];
return parent::buildForm($form, $form_state);
}