function social_tour_form_alter in Open Social 8
Same name and namespace in other branches
- 8.2 modules/custom/social_tour/social_tour.module \social_tour_form_alter()
- 8.3 modules/custom/social_tour/social_tour.module \social_tour_form_alter()
- 8.4 modules/custom/social_tour/social_tour.module \social_tour_form_alter()
- 8.5 modules/custom/social_tour/social_tour.module \social_tour_form_alter()
Implements hook_form_FORM_ID_alter().
File
- modules/
custom/ social_tour/ social_tour.module, line 15 - The Social Tour module.
Code
function social_tour_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if ($form_id == 'user_form') {
$user = \Drupal::routeMatch()
->getParameter('user');
if ($user instanceof User) {
// @TODO: We've currently decided to turn off the possibility for a LU to re-enable the tips.
if (FALSE) {
// Only do this when onboarding is disabled.
// if (\Drupal::service('user.data')->get('social_tour',
// \Drupal::currentUser()->id(), 'onboarding_disabled')) {
// Add the card.
$form['social_tour'] = [
'#type' => 'fieldset',
'#title' => t('Other settings'),
'#tree' => TRUE,
];
// Add the field.
$form['social_tour']['social_tour_onboarding'] = [
'#type' => 'checkbox',
'#title' => t('Show tips on how to use the community'),
'#defaukt_value' => FALSE,
'#attributes' => [
'data-switch' => TRUE,
],
];
// Add a submit action.
$form['actions']['submit']['#submit'][] = '_social_tour_form_user_form_submit';
}
}
}
}