mirror of
				https://github.com/BookStackApp/BookStack.git
				synced 2025-11-04 13:31:45 +03:00 
			
		
		
		
	- Merged book and chapter name items to a single page path list item which has links to parent page/chapter. - Added permission filtering to page path elements. - Added page path to also be on comment notifications. - Updated testing to cover. - Added new Message Line objects to support. Done during review of #4629
		
			
				
	
	
		
			30 lines
		
	
	
		
			759 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			759 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace BookStack\Activity\Notifications\MessageParts;
 | 
						|
 | 
						|
use BookStack\Entities\Models\Entity;
 | 
						|
use Illuminate\Contracts\Support\Htmlable;
 | 
						|
use Stringable;
 | 
						|
 | 
						|
/**
 | 
						|
 * A link to a specific entity in the system, with the text showing its name.
 | 
						|
 */
 | 
						|
class EntityLinkMessageLine implements Htmlable, Stringable
 | 
						|
{
 | 
						|
    public function __construct(
 | 
						|
        protected Entity $entity,
 | 
						|
        protected int $nameLength = 120,
 | 
						|
    ) {
 | 
						|
    }
 | 
						|
 | 
						|
    public function toHtml(): string
 | 
						|
    {
 | 
						|
        return '<a href="' . e($this->entity->getUrl()) . '">' . e($this->entity->getShortName($this->nameLength)) . '</a>';
 | 
						|
    }
 | 
						|
 | 
						|
    public function __toString(): string
 | 
						|
    {
 | 
						|
        return "{$this->entity->getShortName($this->nameLength)} ({$this->entity->getUrl()})";
 | 
						|
    }
 | 
						|
}
 |