You are here

public function Post::getVisibility in Open Social 8.7

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::getVisibility()
  2. 8.4 modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::getVisibility()
  3. 8.5 modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::getVisibility()
  4. 8.6 modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::getVisibility()
  5. 8.8 modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::getVisibility()
  6. 10.3.x modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::getVisibility()
  7. 10.0.x modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::getVisibility()
  8. 10.1.x modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::getVisibility()
  9. 10.2.x modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::getVisibility()

File

modules/social_features/social_post/src/Entity/Post.php, line 163

Class

Post
Defines the Post entity.

Namespace

Drupal\social_post\Entity

Code

public function getVisibility() {
  if ($this
    ->hasField('field_visibility')) {
    switch ($this->field_visibility->value) {
      case "0":
      case "2":
        $visibility = 'community';
        break;
      case "1":
        $visibility = 'public';
        break;
      case "3":
        $visibility = 'group';
        break;
    }
  }
  return $visibility;
}