You are here

function opigno_messaging_social_sharing in Opigno messaging 8

Same name and namespace in other branches
  1. 3.x opigno_messaging.module \opigno_messaging_social_sharing()

Check socials sharing settings.

Parameters

\Drupal\Core\Entity\EntityInterface $group:

Return value

bool Social sharing is allowed.

2 calls to opigno_messaging_social_sharing()
opigno_messaging_get_all_recipients in ./opigno_messaging.module
Helper function to get list of all users that current user can message to.
opigno_messaging_get_user_for_group in ./opigno_messaging.module
Helper function to get users for group.

File

./opigno_messaging.module, line 187
Contains opigno_messaging.module.

Code

function opigno_messaging_social_sharing($group) {
  $social_config = \Drupal::config('opigno_class.socialsettings')
    ->get('social');
  return $social_config & SocialSettingsForm::SAME_CLASS && $group
    ->getGroupType()
    ->id() == 'opigno_class' || $social_config & SocialSettingsForm::SAME_TRAINING && $group
    ->getGroupType()
    ->id() == 'learning_path' || $social_config === SocialSettingsForm::ALL_USERS;
}