Backend Utility

Collection of helpers for backend developing.

class Jar\Utilities\Utilities\BackendUtility

Creates a frontend link, also in backend context.

Parameters:
  • $pageUid (int) – The page uid.
  • $params (array) – Typolink parameters.
Returns:

Link url.

Example:

BackendUtility::createFrontendLink(123, ['lightbox' => 1]);

returns

/a-page?lightbox=1&cHash=ffe...

Jar\Utilities\Utilities\BackendUtility::currentPageUid()

Returns the current page uid (in backend and frontend context).

Returns:Current page uid.

Example:

BackendUtility::currentPageUid();

returns

123

Jar\Utilities\Utilities\BackendUtility::getHostname()

Get the fully-qualified domain name of the host.

Returns:The fully-qualified host name.

Example:

// current Domain is https://example.com/bla
BackendUtility::getHostname();

returns

example.com

Get route link for editing records in backend.

Parameters:
  • $table (string) – The record table.
  • $uid (int) – The record uid.
Returns:

The resulting link.

Example:

BackendUtility::getEditLink('tt_content', 123);

returns

/typo3/index.php?route=%2Frecord%2Fedit&token=75...&returnUrl=%2Ftypo3%2Findex.php%3Froute%3D%252Fmodule%252Fweb%252Flayout%26token%3D74...%26id%3D270%23element-tt_content-123&edit%5Btt_content%5D%5B123%5D=edit

Get route link for editing records in backend. Wrapped in a <a>-Tag

Parameters:
  • $table (string) – The record table.
  • $uid (int) – The record uid.
  • $content (string) – Inner HTML of the <a>-tag.
Returns:

The resulting <a>-tag.

Example:

BackendUtility::getWrappedEditLink('tt_content', 123, 'Click to edit');

returns

<a href="/typo3/index.php?route=%2Frecord%2Fedit&token=...">Click to edit</a>

Jar\Utilities\Utilities\BackendUtility::getWizardInformations($ctype)

Returns informations from the “New Content Wizard”.

Parameters:
  • $ctype (string) – The CType.
Returns:

Informations about that wizard.

Example:

BackendUtility::getWizardInformations('html');

returns

[
   'iconIdentifier' => 'content-special-html',
   'title' => 'Plain HTML',
   'description' => 'With this element you can insert raw HTML code on the page.'
]

Jar\Utilities\Utilities\BackendUtility::getCurrentPageTS()

Returns the current page TSconfig as array.

Returns:Current page TSconfig.

Example:

BackendUtility::getCurrentPageTS();

returns

[
   mod => array(/* 6 items */),
   TCEMAIN => array(/* 4 items */),
   TCEFORM => array(/* 3 items */),
   RTE => array(/* 1 item */),
   options => array(/* 1 item */),
   TCAdefaults => array(/* 2 items */),
   tt_content => array(/* 1 item */),
]