Guides

PageNode extends AbstractNode
in package
implements RenderablePageInterface

FinalYes

Root AST node for a standalone page.

A page is authored in any supported documentation format (RST, Markdown, …), parsed from a dedicated source directory, compiled, and rendered as a self-contained HTML page. Pages are intentionally not part of the documentation tree: they have no toctree membership, no DocumentEntryNode in the ProjectNode, and no menu entries.

The output path for each page is declared inside the source file via a format-specific emitter of PageDestinationNode. If no destination is declared the source file path (without extension) is used as the fallback.

Table of Contents

Interfaces

RenderablePageInterface
Common contract for nodes that are rendered as standalone HTML pages outside the main documentation tree.

Properties

$classes  : array<string|int, string>
$options  : array<string, scalar|array<string|int, scalar>|null>
$value  : TValue
$filePath  : string
$headerNodes  : array<string|int, MetadataNode>
Nodes that are rendered in the HTML <head> (metadata).
$outputPath  : string
Where this page should be written relative to the output root.

Methods

__construct()  : mixed
addHeaderNode()  : void
from()  : self
getChildren()  : array<string|int, Node>
Body nodes that make up the visible page content.
getClasses()  : array<string|int, string>
getClassesString()  : string
getFilePath()  : string
Source file path relative to the pages source directory, without extension.
getHeaderNodes()  : array<string|int, MetadataNode>
Metadata nodes that should be rendered inside the HTML <head>.
getNodes()  : array<string|int, F>
getOption()  : mixed
getOptions()  : array<string, scalar|array<string|int, scalar>|null>
getOutputPath()  : string
Output path relative to the output root, without extension.
getPageTitle()  : string|null
Returns the title string for use in the HTML <title> element, derived from the first {@see PageDestinationNode} or the first section title found in the header nodes.
getValue()  : TValue
hasOption()  : bool
setClasses()  : void
Normalizes class names following the rules of identifier-normalization
setOutputPath()  : void
setValue()  : void
toDocument()  : DocumentNode
withKeepExistingOptions()  : static
Adds $options as default options without overriding any options already set.
withOptions()  : static

Properties

$classes

protected array<string|int, string> $classes = []

$options

protected array<string, scalar|array<string|int, scalar>|null> $options = []

$filePath read-only

private string $filePath

$headerNodes

Nodes that are rendered in the HTML <head> (metadata).

private array<string|int, MetadataNode> $headerNodes = []

$outputPath

Where this page should be written relative to the output root.

private string $outputPath

Does not include the file extension (e.g. "about/index").

Methods

__construct()

public __construct(string $filePath[, array<string|int, Node$children = [] ]) : mixed
Parameters
$filePath : string

Source file path relative to the pages source directory, without extension (e.g. "about/index")

$children : array<string|int, Node> = []

Parsed body nodes (sections, paragraphs, …)

getChildren()

Body nodes that make up the visible page content.

public getChildren() : array<string|int, Node>
Return values
array<string|int, Node>

getClasses()

public getClasses() : array<string|int, string>
Return values
array<string|int, string>

getClassesString()

public getClassesString() : string
Return values
string

getFilePath()

Source file path relative to the pages source directory, without extension.

public getFilePath() : string
Return values
string

getHeaderNodes()

Metadata nodes that should be rendered inside the HTML <head>.

public getHeaderNodes() : array<string|int, MetadataNode>
Return values
array<string|int, MetadataNode>

getNodes()

public getNodes([F> $nodeType = Node::class ]) : array<string|int, F>
Parameters
$nodeType : F> = Node::class
Return values
array<string|int, F>

getOption()

public getOption(string $name[, TType|null $default = null ]) : mixed
Parameters
$name : string
$default : TType|null = null
Tags
phpstan-return

($default is null ? mixed|null: TType|null)

getOptions()

public getOptions() : array<string, scalar|array<string|int, scalar>|null>
Return values
array<string, scalar|array<string|int, scalar>|null>

getOutputPath()

Output path relative to the output root, without extension.

public getOutputPath() : string

Determined from PageDestinationNode if present, otherwise equals getFilePath().

Return values
string

getPageTitle()

Returns the title string for use in the HTML <title> element, derived from the first {@see PageDestinationNode} or the first section title found in the header nodes.

public getPageTitle() : string|null
Return values
string|null

getValue()

public getValue() : TValue
Return values
TValue

hasOption()

public hasOption(string $name) : bool
Parameters
$name : string
Return values
bool

setOutputPath()

public setOutputPath(string $outputPath) : void
Parameters
$outputPath : string

setValue()

public setValue(TValue $value) : void
Parameters
$value : TValue

withKeepExistingOptions()

Adds $options as default options without overriding any options already set.

public withKeepExistingOptions(array<string, scalar|null> $options) : static
Parameters
$options : array<string, scalar|null>
Return values
static

withOptions()

public withOptions(array<string, scalar|array<string|int, scalar>|null> $options) : static
Parameters
$options : array<string, scalar|array<string|int, scalar>|null>
Return values
static
On this page

Search results