function forum_theme_suggestions_forums
Same name in other branches
- 9 core/modules/forum/forum.module \forum_theme_suggestions_forums()
- 8.9.x core/modules/forum/forum.module \forum_theme_suggestions_forums()
- 11.x core/modules/forum/forum.module \forum_theme_suggestions_forums()
Implements hook_theme_suggestions_HOOK().
File
-
core/
modules/ forum/ forum.module, line 376
Code
function forum_theme_suggestions_forums(array $variables) {
$suggestions = [];
$tid = $variables['term']->id();
// Provide separate template suggestions based on what's being output. Topic
// ID is also accounted for. Check both variables to be safe then the inverse.
// Forums with topic IDs take precedence.
if ($variables['forums'] && !$variables['topics']) {
$suggestions[] = 'forums__containers';
$suggestions[] = 'forums__' . $tid;
$suggestions[] = 'forums__containers__' . $tid;
}
elseif (!$variables['forums'] && $variables['topics']) {
$suggestions[] = 'forums__topics';
$suggestions[] = 'forums__' . $tid;
$suggestions[] = 'forums__topics__' . $tid;
}
else {
$suggestions[] = 'forums__' . $tid;
}
return $suggestions;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.