function _social_group_get_group_invite_value in Open Social 8.9
Same name and namespace in other branches
- 10.3.x modules/social_features/social_group/modules/social_group_invite/social_group_invite.module \_social_group_get_group_invite_value()
- 10.0.x modules/social_features/social_group/modules/social_group_invite/social_group_invite.module \_social_group_get_group_invite_value()
- 10.1.x modules/social_features/social_group/modules/social_group_invite/social_group_invite.module \_social_group_get_group_invite_value()
- 10.2.x modules/social_features/social_group/modules/social_group_invite/social_group_invite.module \_social_group_get_group_invite_value()
Return a group invites field value if it exists.
Parameters
\Drupal\group\Entity\GroupContent $entity: Group invitation.
string $field_name: The field name.
Return value
string|null The field value or NULL if there isn't any.
1 call to _social_group_get_group_invite_value()
- social_group_invite_preprocess_views_view_field in modules/
social_features/ social_group/ modules/ social_group_invite/ social_group_invite.module - Implements hook_preprocess_HOOK().
File
- modules/
social_features/ social_group/ modules/ social_group_invite/ social_group_invite.module, line 233 - The Social Invite group module.
Code
function _social_group_get_group_invite_value(GroupContent $entity, $field_name) {
$field_value = NULL;
if ($entity
->hasField($field_name)) {
try {
/** @var \Drupal\Core\TypedData\ListInterface $field */
$field = $entity
->get($field_name)
->first();
if (NULL !== $field && !empty($field
->getValue())) {
$field_value = $field
->getValue()['value'];
}
} catch (MissingDataException $e) {
}
}
return $field_value;
}