‪TYPO3CMS  9.5
TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository Class Reference

Public Member Functions

 __construct ()
 
mixed getShortcutById (int $shortcutId)
 
array getShortcutsByGroup (int $groupId)
 
array getShortcutGroups ()
 
array getGroupsFromShortcuts ()
 
bool shortcutExists (string $url)
 
bool addShortcut (string $url, string $module, string $parentModule='', string $title='')
 
bool updateShortcut (int $id, string $title, int $groupId)
 
bool removeShortcut (int $id)
 

Protected Member Functions

array initShortcutGroups ()
 
array initShortcuts ()
 
array getGlobalShortcutGroups ()
 
string getShortcutGroupLabel (int $groupId)
 
string getShortcutIcon (array $row, array $shortcut)
 
string getShortcutIconTitle (string $shortcutLabel, string $moduleName, string $parentModuleName='')
 
int extractPageIdFromShortcutUrl (string $url)
 
string getTokenUrl (string $url)
 
BackendUserAuthentication getBackendUser ()
 
LanguageService getLanguageService ()
 

Protected Attributes

const SUPERGLOBAL_GROUP = -100
 
array $shortcuts
 
array $shortcutGroups
 
IconFactory $iconFactory
 
ModuleLoader $moduleLoader
 

Detailed Description

Repository for backend shortcuts

This class is a specific Backend implementation and is not considered part of the Public TYPO3 API.

Definition at line 40 of file ShortcutRepository.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::__construct ( )

Member Function Documentation

◆ addShortcut()

bool TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::addShortcut ( string  $url,
string  $module,
string  $parentModule = '',
string  $title = '' 
)

Add a shortcut

Parameters
string$url‪URL of the new shortcut
string$module‪module identifier of the new shortcut
string$parentModule‪parent module identifier of the new shortcut
string$title‪title of the new shortcut
Returns
‪bool
Exceptions

Definition at line 188 of file ShortcutRepository.php.

References $GLOBALS, TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\extractPageIdFromShortcutUrl(), TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getBackendUser(), TYPO3\CMS\Core\Resource\ResourceFactory\getInstance(), TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getLanguageService(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecord(), and TYPO3\CMS\Core\Localization\LanguageService\sL().

◆ extractPageIdFromShortcutUrl()

int TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::extractPageIdFromShortcutUrl ( string  $url)
protected

Return the ID of the page in the URL if found.

Parameters
string$url‪The URL of the current shortcut link
Returns
‪int If a page ID was found, it is returned. Otherwise: 0

Definition at line 714 of file ShortcutRepository.php.

Referenced by TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\addShortcut(), and TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\initShortcuts().

◆ getBackendUser()

◆ getGlobalShortcutGroups()

array TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getGlobalShortcutGroups ( )
protected

Gets a list of global groups, shortcuts in these groups are available to all users

Returns
‪array Array of global groups

Definition at line 567 of file ShortcutRepository.php.

Referenced by TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\initShortcuts().

◆ getGroupsFromShortcuts()

array TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getGroupsFromShortcuts ( )

runs through the available shortcuts an collects their groups

Returns
‪array Array of groups which have shortcuts

Definition at line 137 of file ShortcutRepository.php.

◆ getLanguageService()

LanguageService TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getLanguageService ( )
protected

◆ getShortcutById()

mixed TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getShortcutById ( int  $shortcutId)

Gets a shortcut by its uid

Parameters
int$shortcutIdShortcut id to get the complete shortcut for
Returns
‪mixed An array containing the shortcut's data on success or FALSE on failure

Definition at line 82 of file ShortcutRepository.php.

Referenced by TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\removeShortcut().

◆ getShortcutGroupLabel()

string TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getShortcutGroupLabel ( int  $groupId)
protected

Gets the label for a shortcut group

Parameters
int$groupId‪A shortcut group id
Returns
‪string The shortcut group label, can be an empty string if no group was found for the id

Definition at line 586 of file ShortcutRepository.php.

Referenced by TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\initShortcuts().

◆ getShortcutGroups()

array TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getShortcutGroups ( )

Get shortcut groups the current user has access to

Returns
‪array

Definition at line 117 of file ShortcutRepository.php.

References TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\$shortcutGroups, and TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getBackendUser().

◆ getShortcutIcon()

string TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getShortcutIcon ( array  $row,
array  $shortcut 
)
protected

Gets the icon for the shortcut

Parameters
array$row
array$shortcut
Returns
‪string Shortcut icon as img tag

Definition at line 598 of file ShortcutRepository.php.

References $GLOBALS, and TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL.

Referenced by TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\initShortcuts().

◆ getShortcutIconTitle()

string TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getShortcutIconTitle ( string  $shortcutLabel,
string  $moduleName,
string  $parentModuleName = '' 
)
protected

Returns title for the shortcut icon

Parameters
string$shortcutLabelShortcut label
string$moduleNameBackend module name (key)
string$parentModuleName‪Parent module label
Returns
‪string Title for the shortcut icon

Definition at line 682 of file ShortcutRepository.php.

References TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getLanguageService().

Referenced by TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\initShortcuts().

◆ getShortcutsByGroup()

array TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getShortcutsByGroup ( int  $groupId)

Gets shortcuts for a specific group

Parameters
int$groupId‪Group Id
Returns
‪array Array of shortcuts that matched the group

Definition at line 99 of file ShortcutRepository.php.

References TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\$shortcuts.

◆ getTokenUrl()

string TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getTokenUrl ( string  $url)
protected

Adds the correct token, if the url is an index.php script

Todo:
‪: this needs love
Parameters
string$url
Returns
‪string

Definition at line 726 of file ShortcutRepository.php.

Referenced by TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\initShortcuts().

◆ initShortcutGroups()

array TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::initShortcutGroups ( )
protected

◆ initShortcuts()

◆ removeShortcut()

bool TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::removeShortcut ( int  $id)

Remove a shortcut

Parameters
int$id‪identifier of a shortcut
Returns
‪bool

Definition at line 343 of file ShortcutRepository.php.

References TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getBackendUser(), and TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getShortcutById().

◆ shortcutExists()

bool TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::shortcutExists ( string  $url)

Returns if there already is a shortcut entry for a given TYPO3 URL

Parameters
string$url
Returns
‪bool

Definition at line 154 of file ShortcutRepository.php.

◆ updateShortcut()

bool TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::updateShortcut ( int  $id,
string  $title,
int  $groupId 
)

Update a shortcut

Parameters
int$id‪identifier of a shortcut
string$title‪new title of the shortcut
int$groupId‪new group identifier of the shortcut
Returns
‪bool

Definition at line 303 of file ShortcutRepository.php.

References TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getBackendUser().

Member Data Documentation

◆ $iconFactory

IconFactory TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::$iconFactory
protected

Definition at line 57 of file ShortcutRepository.php.

◆ $moduleLoader

ModuleLoader TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::$moduleLoader
protected

Definition at line 61 of file ShortcutRepository.php.

◆ $shortcutGroups

array TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::$shortcutGroups
protected

◆ $shortcuts

array TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::$shortcuts
protected

◆ SUPERGLOBAL_GROUP

const TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::SUPERGLOBAL_GROUP = -100
protected