3 namespace BookStack\Activity\Notifications\MessageParts;
5 use BookStack\Entities\Models\Entity;
6 use Illuminate\Contracts\Support\Htmlable;
10 * A link to a specific entity in the system, with the text showing its name.
12 class EntityLinkMessageLine implements Htmlable, Stringable
14 public function __construct(
15 protected Entity $entity,
16 protected int $nameLength = 120,
20 public function toHtml(): string
22 return '<a href="' . e($this->entity->getUrl()) . '">' . e($this->entity->getShortName($this->nameLength)) . '</a>';
25 public function __toString(): string
27 return "{$this->entity->getShortName($this->nameLength)} ({$this->entity->getUrl()})";