function opigno_forum_preprocess_node in Opigno forum 3.x
Same name and namespace in other branches
- 8 opigno_forum.module \opigno_forum_preprocess_node()
Implements hook_preprocess_HOOK().
File
- ./
opigno_forum.module, line 234 - Contains opigno_forum.module.
Code
function opigno_forum_preprocess_node(&$variables) {
if ($variables['node']
->getType() == 'forum' && $variables['view_mode'] == 'full') {
$node = $variables['node'];
$topics_list_link = $node->taxonomy_forums
->getValue();
if (!empty($topics_list_link)) {
$variables['topics_list_link'] = Link::createFromRoute(t('To the topics list'), 'forum.page', [
'taxonomy_term' => $topics_list_link['0']['target_id'],
], [
'attributes' => [
'class' => 'btn btn-success color-white text-uppercase btn-back',
],
]);
}
}
}