You are here

private function CloudBuilder::displayTermLinkCount in TagCloud 8

Same name and namespace in other branches
  1. 2.0.x src/CloudBuilder.php \Drupal\tagclouds\CloudBuilder::displayTermLinkCount()
  2. 1.0.x src/CloudBuilder.php \Drupal\tagclouds\CloudBuilder::displayTermLinkCount()
1 call to CloudBuilder::displayTermLinkCount()
CloudBuilder::build in src/CloudBuilder.php
Returns a render array for the tags.

File

src/CloudBuilder.php, line 136

Class

CloudBuilder
Class CloudBuilder.

Namespace

Drupal\tagclouds

Code

private function displayTermLinkCount($name, $tid, $count, $description) {
  if ($term = Term::load($tid)) {
    $uri = $term
      ->urlInfo();
    $options = $uri
      ->getOptions();
    $options['options']['attributes']['class'][] = 'tagclouds';
    $build = [
      '#type' => 'link',
      '#prefix' => '<span class="tagclouds-term">',
      '#title' => $name,
      '#url' => $uri,
      '#suffix' => "({$count}) </span>",
    ];
    return $build;
  }
}