5 use Drupal\Component\Render\MarkupInterface;
6 use Drupal\Core\Render\BubbleableMetadata;
9 * Used to return generated links, along with associated cacheability metadata.
11 * Note: not to be confused with \Drupal\Core\Link, which is for passing around
12 * ungenerated links (typically link text + route name + route parameters).
14 class GeneratedLink extends BubbleableMetadata implements MarkupInterface, \Countable {
17 * HTML tag to use when building the link.
22 * The HTML string value containing a link.
26 protected $generatedLink = '';
29 * Gets the generated link.
33 public function getGeneratedLink() {
34 return $this->generatedLink;
38 * Sets the generated link.
40 * @param string $generated_link
45 public function setGeneratedLink($generated_link) {
46 $this->generatedLink = $generated_link;
53 public function __toString() {
54 return (string) $this->generatedLink;
60 public function jsonSerialize() {
61 return $this->__toString();
67 public function count() {
68 return mb_strlen($this->__toString());