function socialbase_group_link in Open Social 8.2
Same name and namespace in other branches
- 8.9 themes/socialbase/socialbase.theme \socialbase_group_link()
- 8 themes/socialbase/socialbase.theme \socialbase_group_link()
- 8.3 themes/socialbase/socialbase.theme \socialbase_group_link()
- 8.4 themes/socialbase/socialbase.theme \socialbase_group_link()
- 8.5 themes/socialbase/socialbase.theme \socialbase_group_link()
- 8.6 themes/socialbase/socialbase.theme \socialbase_group_link()
- 8.7 themes/socialbase/socialbase.theme \socialbase_group_link()
- 8.8 themes/socialbase/socialbase.theme \socialbase_group_link()
Prepare group link when an event or topic belongs to one group.
1 call to socialbase_group_link()
- Node::preprocessElement in themes/
socialbase/ src/ Plugin/ Preprocess/ Node.php - Preprocess the variables array if an element is present.
File
- themes/
socialbase/ socialbase.theme, line 29 - The primary PHP file for the Social base theme.
Code
function socialbase_group_link($node) {
$group = _social_group_get_current_group($node);
$group_link = NULL;
// Exclude nodes without ids (Preview).
if (!empty($node
->id()) && !empty($group)) {
$group_type_id = $group
->getGroupType()
->id();
$group_content = \Drupal::entityTypeManager()
->getStorage('group_content')
->loadByProperties([
'entity_id' => $node
->id(),
'type' => $group_type_id . '-group_node-' . $node
->getType(),
]);
if (!empty($group_content)) {
$group_link = $group
->link();
}
}
return $group_link;
}