You are here

public function ForumTopicRender::preprocessForumLastTopicsItem in Opigno forum 3.x

Prepares variables for opigno_forum_last_topics_item template.

Throws

\Drupal\Core\Entity\EntityMalformedException

File

src/ForumTopicRender.php, line 27

Class

ForumTopicRender
Forum topic render helper class.

Namespace

Drupal\opigno_forum

Code

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;
}