LinkService

class \TYPO3\CMS\Core\LinkHandling\LinkService

Implements
SingletonInterface

Class LinkService, responsible to find what kind of resource (type) is used to link to (email, external url, file, page etc) with the possibility to get a system-wide understandable "urn" to identify what type it actually is, based on the scheme or prefix.

Table of Contents

Interfaces

SingletonInterface
"empty" interface for singletons (marker interface pattern)

Constants

TYPE_EMAIL  : mixed = 'email'
TYPE_FILE  : mixed = 'file'
TYPE_FOLDER  : mixed = 'folder'
TYPE_PAGE  : mixed = 'page'
TYPE_RECORD  : mixed = 'record'
TYPE_TELEPHONE  : mixed = 'telephone'
TYPE_UNKNOWN  : mixed = 'unknown'
TYPE_URL  : mixed = 'url'

Properties

$handlers  : LinkHandlingInterface[]
All registered LinkHandlers

Methods

__construct()  : mixed
LinkService constructor initializes the registered handlers.
asString()  : string
Returns a string interpretation of the link target, something like
resolve()  : array
Part of the typolink construction functionality, called by typoLink() Used to resolve "legacy"-based typolinks and URNs.
resolveByStringRepresentation()  : array
Returns an array with data interpretation of the link target, something like t3://page?uid=23.

Constants

TYPE_EMAIL

public mixed TYPE_EMAIL = 'email'

TYPE_FOLDER

public mixed TYPE_FOLDER = 'folder'

TYPE_RECORD

public mixed TYPE_RECORD = 'record'

TYPE_TELEPHONE

public mixed TYPE_TELEPHONE = 'telephone'

TYPE_UNKNOWN

public mixed TYPE_UNKNOWN = 'unknown'

Properties

Methods

__construct()

LinkService constructor initializes the registered handlers.

public __construct() : mixed

asString()

Returns a string interpretation of the link target, something like

public asString(array $parameters) : string
  • t3://page?uid=23&my=value#cool
  • https://www.typo3.org/
  • t3://file?uid=13
  • t3://folder?storage=2&identifier=/my/folder/
  • mailto:mac@safe.com

Parameters

$parameters : array

Tags

throws
UnknownLinkHandlerException

Return values

string

resolve()

Part of the typolink construction functionality, called by typoLink() Used to resolve "legacy"-based typolinks and URNs.

public resolve(string $linkParameter) : array

Tries to get the type of the link from the link parameter could be

  • "mailto" an email address
  • "url" external URL
  • "file" a local file (checked AFTER getPublicUrl() is called)
  • "page" a page (integer)

Does NOT check if the page exists or the file exists.

Parameters

$linkParameter : string

could be "fileadmin/myfile.jpg", "info@typo3.org", "13" or "http://www.typo3.org"

Return values

array

resolveByStringRepresentation()

Returns an array with data interpretation of the link target, something like t3://page?uid=23.

public resolveByStringRepresentation(string $urn) : array

Parameters

$urn : string

Tags

throws
UnknownLinkHandlerException
throws
UnknownUrnException

Return values

array
On this page