SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class Lnk

This is a system of portable, extensible link management.

The system is based around the "link specification", which is a string.
Link specifications should be stored in a TEXT field.

These specs relate to classes which extend LinkSpec.
The class name needs to start with "LinkSpec" too.

Functions

NameVisibilityDescription
atagpublic (static)Return an opening A tag for a link specification.
editformpublic (static)Output html for editing link specifications.
editformNeedspublic (static)Some edit forms require additional javascript via the needs helper
instanceprivate (static)For a given link specification, instance it's class
tryUrlpublic (static)Attempts to convert a link specification into a URL
typenamepublic (static)Output the name of the type of the linkspec.
urlpublic (static)Convert a link specification into a URL.
validpublic (static)Check if the data supplied for a spec is valid.

public atag

string Lnk::atag ( string $spec , array $attributes );

Return an opening A tag for a link specification.

public editform

string Lnk::editform ( string $field_name [, string $curr_spec [, bool $required ]] );

Output html for editing link specifications.
This is designed for admin use.

public editformNeeds

void Lnk::editformNeeds ( );

Some edit forms require additional javascript via the needs helper
Load in all of these requirements for all LinkSpec classes

private instance

array Lnk::instance ( string $spec );

For a given link specification, instance it's class

public tryUrl

string|null Lnk::tryUrl ( string $spec );

Attempts to convert a link specification into a URL

This differs in behaviour to `Lnk::url` as it will return null if the spec is
empty, but *not* malformed; it still throws an InvalidArgumentException in that case.
It will also return null if a RowMissingException is thrown by the link spec instance
during processing.

Helpful when you wish to avoid breaking pages when someone deletes the linked record, e.g. a blog post,
without updating the corresponding link(s).

public typename

string Lnk::typename ( string $spec );

Output the name of the type of the linkspec.

public url

string Lnk::url ( string $spec );

Convert a link specification into a URL.

public valid

bool Lnk::valid ( string $spec );

Check if the data supplied for a spec is valid.