protected function MembershipManager::prepareConditionArray in Organic groups 8
Prepares a conditional array for use in a cache identifier and query.
This will filter out any duplicate values from the array and sort the values so that a consistent cache identifier can be generated. Optionally it can substitute an empty array with a default value.
Parameters
array $value: The array to prepare.
array|null $default: An optional default value to use in case the passed in value is empty. If set to NULL this will be ignored.
Return value
array The prepared array.
2 calls to MembershipManager::prepareConditionArray()
- MembershipManager::getGroupMembershipIdsByRoleNames in src/
MembershipManager.php - Returns the membership IDs of the given group filtered by role names.
- MembershipManager::getMemberships in src/
MembershipManager.php - Returns the group memberships a user is associated with.
File
- src/
MembershipManager.php, line 466
Class
- MembershipManager
- Service for managing memberships and group content.
Namespace
Drupal\ogCode
protected function prepareConditionArray(array $value, ?array $default = NULL) {
// Fall back to the default value if the passed in value is empty and a
// default value is given.
if (empty($value) && $default !== NULL) {
$value = $default;
}
sort($value);
return array_unique($value);
}