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

Public Member Functions

 __construct (protected readonly ConnectionPool $connectionPool, protected readonly IconFactory $iconFactory, protected readonly ModuleProvider $moduleProvider, protected readonly Router $router, protected readonly UriBuilder $uriBuilder,)
 
mixed getShortcutById (int $shortcutId)
 
array getShortcutsByGroup (int $groupId)
 
 getShortcutGroups ()
 
array getGroupsFromShortcuts ()
 
 shortcutExists (string $routeIdentifier, string $arguments)
 
 addShortcut (string $routeIdentifier, string $arguments='', string $title='')
 
 updateShortcut (int $id, string $title, int $groupId)
 
 removeShortcut (int $id)
 

Protected Member Functions

 initShortcutGroups ()
 
array initShortcuts ()
 
array getGlobalShortcutGroups ()
 
string getShortcutGroupLabel (int $groupId)
 
string getShortcutIcon (string $routeIdentifier, string $moduleName, array $shortcut)
 
 getModuleNameFromRouteIdentifier (string $routeIdentifier)
 
 isSpecialRoute (string $routeIdentifier)
 
 getBackendUser ()
 
 getLanguageService ()
 

Protected Attributes

const SUPERGLOBAL_GROUP = -100
 
const TABLE_NAME = 'sys_be_shortcuts'
 
array $shortcuts
 
array $shortcutGroups
 

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 41 of file ShortcutRepository.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::__construct ( protected readonly ConnectionPool  $connectionPool,
protected readonly IconFactory  $iconFactory,
protected readonly ModuleProvider  $moduleProvider,
protected readonly Router  $router,
protected readonly UriBuilder  $uriBuilder 
)

Member Function Documentation

◆ addShortcut()

TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::addShortcut ( string  $routeIdentifier,
string  $arguments = '',
string  $title = '' 
)

Add a shortcut

Parameters
string$routeIdentifier‪route identifier of the new shortcut
string$arguments‪arguments of the new shortcut
string$title‪title of the new shortcut
Exceptions

Definition at line 167 of file ShortcutRepository.php.

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

◆ 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 486 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 and collects their groups

Returns
‪array Array of groups which have shortcuts

Definition at line 124 of file ShortcutRepository.php.

◆ getLanguageService()

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

◆ getModuleNameFromRouteIdentifier()

TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getModuleNameFromRouteIdentifier ( string  $routeIdentifier)
protected

Get the module name from the resolved route or by static mapping for some special cases.

Definition at line 550 of file ShortcutRepository.php.

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

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

◆ 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 71 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 505 of file ShortcutRepository.php.

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

◆ getShortcutGroups()

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

◆ getShortcutIcon()

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

Gets the icon for the shortcut

Returns
‪string Shortcut icon as img tag

Definition at line 515 of file ShortcutRepository.php.

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 88 of file ShortcutRepository.php.

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

◆ initShortcutGroups()

◆ initShortcuts()

◆ isSpecialRoute()

TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::isSpecialRoute ( string  $routeIdentifier)
protected

Check if given route identifier is a special "no module" route

Definition at line 562 of file ShortcutRepository.php.

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

◆ removeShortcut()

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

◆ shortcutExists()

TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::shortcutExists ( string  $routeIdentifier,
string  $arguments 
)

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

Definition at line 138 of file ShortcutRepository.php.

References TYPO3\CMS\Webhooks\Message\$uid, and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

◆ updateShortcut()

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

Definition at line 196 of file ShortcutRepository.php.

References TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getBackendUser(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Member Data Documentation

◆ $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

◆ TABLE_NAME

const TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::TABLE_NAME = 'sys_be_shortcuts'
protected

Definition at line 48 of file ShortcutRepository.php.