/** * Builds an individual term item for the term item list depending on the formatter. * * @param \Drupal\taxonomy\Entity\Term $term * @return string */ private function buildTermListItem(Term $term, $formatter) { if ($formatter === 'linked') { $link_url = Url::fromRoute('entity.taxonomy_term.canonical', array('taxonomy_term' => $term->id())); return \Drupal::l($term->label(), $link_url); } return HTML::escape($term->label()); }
public static function link($destination, $text) { return '<a href="' . HTML::escape(URI::get($destination)) . '">' . HTML::escape($text) . '</a>'; }
private static function setProgressInfo(&$context) { if ($context['sandbox']['progress'] != $context['sandbox']['max']) { // Providing progress info to the batch API. $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; // Adding processing message after finishing every batch segment. end($context['results']['generate']); $last_key = key($context['results']['generate']); if (!empty($context['results']['generate'][$last_key]['path'])) { $context['message'] = t("Processing path @current out of @max: @path", ['@current' => $context['sandbox']['progress'], '@max' => $context['sandbox']['max'], '@path' => HTML::escape($context['results']['generate'][$last_key]['path'])]); } } }