|link

|link

Twig Filter

The |link filter returns a link generated using the october:// output schema of a page finder form widget. The result is a public URL to the page specified by the form widget.

<a href="___TWIG0___" />

If you are looking to parse HTML for multiple links and resolve them as HTTP links in the output, see the |content Twig filter.

The complimentary link() function is used to extract more detailed information about a link.

___TWIG0___

___TWIG1___

The following properties can be expected in the resulting object.

PropertyData
urlthe public URL to the page.
mtimethe modification time of the page link.
titlea human readable title for the link, optional.
itemsan array containing generated child items, optional.
isActiveset to true if the link is currently active.

You may request nested child items by passing the nesting option to true (second argument), which populates the items property on the result.

___TWIG0___

___TWIG1___
    ___TWIG2___
___TWIG3___

You may request other site URLs by passing the sites option to true, which populates the sites property on the result.

___TWIG0___

___TWIG1___
    ___TWIG2___
___TWIG3___

# PHP Interface

You may resolve links in PHP using the Cms\Classes\PageManager class. The url method returns a string to the public URL.

Cms\Classes\PageManager::url('october://cms-page@link/about');

The resolve method returns a detailed Cms\Models\PageLookupItem object.

$page = Cms\Classes\PageManager::resolve('october://cms-page@link/about');

echo $page->url;

# See Also