function socialbase_group_link in Open Social 8.9
Same name and namespace in other branches
- 8 themes/socialbase/socialbase.theme \socialbase_group_link()
- 8.2 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 34 - 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_content = \Drupal::entityTypeManager()
->getStorage('group_content')
->loadByProperties([
'entity_id' => $node
->id(),
]);
if (!empty($group_content)) {
$curr_langcode = \Drupal::languageManager()
->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)
->getId();
if ($group
->isTranslatable() && $group
->hasTranslation($curr_langcode)) {
$group = $group
->getTranslation($curr_langcode);
}
$group_link = $group
->link();
}
}
return $group_link;
}