You are here

private function CloudBuilder::displayNodeLinkCount in TagCloud 1.0.x

Same name and namespace in other branches
  1. 8 src/CloudBuilder.php \Drupal\tagclouds\CloudBuilder::displayNodeLinkCount()
  2. 2.0.x src/CloudBuilder.php \Drupal\tagclouds\CloudBuilder::displayNodeLinkCount()

Display Single Tag with Style

1 call to CloudBuilder::displayNodeLinkCount()
CloudBuilder::build in src/CloudBuilder.php
Returns a render array for the tags.

File

src/CloudBuilder.php, line 118

Class

CloudBuilder
Class CloudBuilder.

Namespace

Drupal\tagclouds

Code

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