BookStackApp_BookStack/app/Entities/Tools/PageIncludeTag.php
Dan Brown 75936454cc
Includes: Developed to get new system working with inline includes
Adds logic for locating and splitting text nodes.
Adds specific classes to offload tag/content specific logic.
2023-11-23 14:29:07 +00:00

31 lines
579 B
PHP

<?php
namespace BookStack\Entities\Tools;
use DOMNode;
class PageIncludeTag
{
public function __construct(
public string $tagContent,
public DOMNode $domNode,
) {
}
/**
* Get the page ID that this tag references.
*/
public function getPageId(): int
{
return intval(trim(explode('#', $this->tagContent, 2)[0]));
}
/**
* Get the section ID that this tag references (if any)
*/
public function getSectionId(): string
{
return trim(explode('#', $this->tagContent, 2)[1] ?? '');
}
}