View source
<?php
use Drupal\Core\Routing\RouteMatchInterface;
function tagclouds_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.tagclouds':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Tagclouds offers dynamic urls.') . '</p>';
$output .= '<p>' . t('Visit example.com/tagclouds/list/{Taxonomy Vocabulary name} (for example "Tags") to get the vocabulary name, description and all tags.') . '</p>';
$output .= '<p>' . t('Visit example.com/tagclouds/chunk/{Taxonomy Vocabulary name} (for example "Tags") to get a tag cloud of the terms for this vocabulary.') . '</p>';
return $output;
}
}
function tagclouds_theme() {
return [
'tagclouds_list_box' => [
'variables' => [
'vocabulary' => NULL,
'children' => NULL,
],
],
'tagclouds_weighted' => [
'variables' => [
'terms' => [],
'children' => NULL,
],
],
];
}
function tagclouds_i18n_taxonomy_term_description($term, $langcode = NULL) {
return i18n_taxonomy_vocabulary_mode($term->vid, I18N_MODE_LOCALIZE) ? i18n_string([
'taxonomy',
'term',
$term->tid,
'description',
], $term->description, [
'langcode' => $langcode,
'sanitize' => FALSE,
]) : $term->description;
}
function tagclouds_i18n_taxonomy_vocabulary_description($vocabulary, $langcode = NULL) {
return i18n_object_langcode($vocabulary) ? $vocabulary->description : i18n_string([
'taxonomy',
'vocabulary',
$vocabulary->vid,
'description',
], $vocabulary->description, [
'langcode' => $langcode,
]);
}