Elgg  Version 7.1
GroupHelpers.php
Go to the documentation of this file.
1 <?php
2 
4 
11 trait GroupHelpers {
12 
13  private array $visibility = [
17  ];
18 
19  private array $content_access_modes = [
22  ];
23 
24  private array $membership = [
28  ];
29 
34  public function getRandomGroupVisibility(): int {
35  $key = array_rand($this->visibility, 1);
36 
37  return $this->visibility[$key];
38  }
39 
44  public function getRandomGroupContentAccessMode(): string {
45  $key = array_rand($this->content_access_modes, 1);
46 
47  return $this->content_access_modes[$key];
48  }
49 
54  public function getRandomGroupMembership(): int {
55  $key = array_rand($this->membership, 1);
56 
57  return $this->membership[$key];
58  }
59 }
const MEMBERSHIP_CLOSED
Definition: ElggGroup.php:19
const CONTENT_ACCESS_MODE_MEMBERS_ONLY
Definition: ElggGroup.php:17
const CONTENT_ACCESS_MODE_UNRESTRICTED
Definition: ElggGroup.php:16
const MEMBERSHIP_PUBLIC
Definition: ElggGroup.php:21
const MEMBERSHIP_INVITE_ONLY
Definition: ElggGroup.php:20
const ACCESS_PRIVATE
Definition: constants.php:10
const ACCESS_LOGGED_IN
Definition: constants.php:11
const ACCESS_PUBLIC
Definition: constants.php:12
trait GroupHelpers
Group helpers for seeding.
getRandomGroupVisibility()
Returns random visibility value.
getRandomGroupContentAccessMode()
Returns random content access mode value.
getRandomGroupMembership()
Returns random membership mode.
if($container instanceof ElggGroup && $container->guid !=elgg_get_page_owner_guid()) $key
Definition: summary.php:44