You are here

public function SocialTourController::toggleOnboarding in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  2. 8 modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  3. 8.2 modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  4. 8.3 modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  5. 8.4 modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  6. 8.5 modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  7. 8.6 modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  8. 8.7 modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  9. 10.3.x modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  10. 10.0.x modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  11. 10.1.x modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()
  12. 10.2.x modules/custom/social_tour/src/SocialTourController.php \Drupal\social_tour\SocialTourController::toggleOnboarding()

Toggle onboarding.

Parameters

array $account: Array containing the account.

File

modules/custom/social_tour/src/SocialTourController.php, line 125

Class

SocialTourController
Class SocialTourController.

Namespace

Drupal\social_tour

Code

public function toggleOnboarding(array $account = NULL) {

  // No user given, then current user.
  $id = $this->currentUser
    ->id();
  if ($account instanceof UserInterface) {
    $id = $account
      ->id();
  }
  $new_value = TRUE;
  if ($this->userData
    ->get('social_tour', $id, 'onboarding_disabled')) {
    $new_value = FALSE;
  }

  // Save the value in the user_data.
  $this
    ->setData($new_value);
}