SproutCMS features a way to register arbitrary types of content which can be linked to from within any kind of record. Each type of content has its own link specification, LinkSpec, which defines an interface for configuring the link, and what the resulting URL to the content will be.
For example, the LinkSpecPage class defines a link to a page.
There are three methods which each LinkSpec needs to implement:
getEditForm - This provides the interface for selecting the item to link to. In the case of LinkSpecPage, this provides a dropdown which selects the page ID.
isValid - This checks that the chosen item is valid.
getUrl - This converts the reference to the chosen item (usually an ID) to a URL used to access it.
To add an arbitrary new kind of content which can be linked to, you simply create a helper which extends LinkSpec, then register that helper as a selectable link specification.
The following example registers blog posts as a type of content which can be linked to: