public function Post::setVisibility in Open Social 8.4
Same name and namespace in other branches
- 8.9 modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::setVisibility()
- 8.5 modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::setVisibility()
- 8.6 modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::setVisibility()
- 8.7 modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::setVisibility()
- 8.8 modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::setVisibility()
- 10.3.x modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::setVisibility()
- 10.0.x modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::setVisibility()
- 10.1.x modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::setVisibility()
- 10.2.x modules/social_features/social_post/src/Entity/Post.php \Drupal\social_post\Entity\Post::setVisibility()
File
- modules/
social_features/ social_post/ src/ Entity/ Post.php, line 188
Class
- Post
- Defines the Post entity.
Namespace
Drupal\social_post\EntityCode
public function setVisibility($visibility) {
if ($this
->hasField('field_visibility')) {
switch ($visibility) {
case 'community':
$this
->set('field_visibility', 0);
break;
case 'public':
$this
->set('field_visibility', 1);
break;
case "group":
$this
->set('field_visibility', 3);
break;
}
}
return $this;
}