TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
LinkService Class Reference
Inheritance diagram for LinkService:
SingletonInterface

Public Member Functions

 __construct ()
 
 resolve (string $linkParameter)
 
 resolveByStringRepresentation (string $urn)
 
 asString (array $parameters)
 

Public Attributes

const TYPE_PAGE = 'page'
 
const TYPE_URL = 'url'
 
const TYPE_EMAIL = 'email'
 
const TYPE_FILE = 'file'
 
const TYPE_FOLDER = 'folder'
 
const TYPE_UNKNOWN = 'unknown'
 

Protected Attributes

 $handlers
 

Detailed Description

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.

Definition at line 27 of file LinkService.php.

Constructor & Destructor Documentation

__construct ( )

LinkService constructor initializes the registered handlers.

Definition at line 46 of file LinkService.php.

References $GLOBALS, and GeneralUtility\makeInstance().

Member Function Documentation

asString ( array  $parameters)

Returns a string interpretation of the link target, something like

Parameters
array$parameters
Returns
string
Exceptions
InvalidArgumentException

Definition at line 140 of file LinkService.php.

resolve ( string  $linkParameter)

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

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 or alias)

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

Parameters
string$linkParametercould be "fileadmin/myfile.jpg", "info@typo3.org", "13" or "http://www.typo3.org"
Returns
array

Definition at line 73 of file LinkService.php.

References GeneralUtility\makeInstance(), and LinkService\resolveByStringRepresentation().

resolveByStringRepresentation ( string  $urn)

Returns a array with data interpretation of the link target, something like t3:blabla.

Parameters
string$urn
Returns
array

Definition at line 90 of file LinkService.php.

Referenced by LinkService\resolve().

Member Data Documentation

$handlers
protected

Definition at line 41 of file LinkService.php.

const TYPE_EMAIL = 'email'
const TYPE_UNKNOWN = 'unknown'
const TYPE_URL = 'url'