class ForumTopicRender in Opigno forum 3.x
Forum topic render helper class.
Hierarchy
- class \Drupal\opigno_forum\ForumTopicRender
Expanded class hierarchy of ForumTopicRender
1 file declares its use of ForumTopicRender
- opigno_forum.module in ./
opigno_forum.module - Contains opigno_forum.module.
File
- src/
ForumTopicRender.php, line 8
Namespace
Drupal\opigno_forumView source
class ForumTopicRender {
/**
* Prepares variables for opigno_forum_last_topics_block template.
*/
public function preprocessForumLastTopicsBlock(array &$variables) : void {
foreach ($variables["elements"]["topics"] as $index => $topic) {
$variables["elements"]["topics"][$index] = [
'#theme' => 'opigno_forum_last_topics_item',
'#topic' => $topic,
];
}
}
/**
* Prepares variables for opigno_forum_last_topics_item template.
*
* @throws \Drupal\Core\Entity\EntityMalformedException
*/
public function preprocessForumLastTopicsItem(array &$variables) : void {
/** @var \Drupal\node\Entity\Node $topic */
$topic =& $variables["topic"];
$variables['name'] = $topic
->label();
$variables['link'] = $topic
->toUrl()
->toString();
$variables['new_posts'] = $topic->new_replies;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ForumTopicRender:: |
public | function | Prepares variables for opigno_forum_last_topics_block template. | |
ForumTopicRender:: |
public | function | Prepares variables for opigno_forum_last_topics_item template. |