forum_theme_suggestions_forums

forum_theme_suggestions_forums(array $variables)

Implements hook_theme_suggestions_HOOK().

File

core/modules/forum/forum.module, line 363
Provides discussion forums.

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function forum_theme_suggestions_forums(array $variables) {
  $suggestions = array();
  $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;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.