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

Public Member Functions

 __construct (ConnectionPool $connectionPool, IconFactory $iconFactory, ModuleLoader $moduleLoader)
 
mixed getShortcutById (int $shortcutId)
 
array getShortcutsByGroup (int $groupId)
 
array getShortcutGroups ()
 
array getGroupsFromShortcuts ()
 
bool shortcutExists (string $routeIdentifier, string $arguments)
 
bool addShortcut (string $routeIdentifier, string $arguments='', 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 (string $routeIdentifier, string $moduleName, array $shortcut)
 
string getModuleNameFromRouteIdentifier (string $routeIdentifier)
 
Route null getRoute (string $routeIdentifier)
 
bool routeExists (string $routeIdentifier)
 
bool isSpecialRoute (string $routeIdentifier)
 
BackendUserAuthentication getBackendUser ()
 
LanguageService getLanguageService ()
 

Protected Attributes

const SUPERGLOBAL_GROUP = -100
 
const TABLE_NAME = 'sys_be_shortcuts'
 
array $shortcuts
 
array $shortcutGroups
 
ConnectionPool $connectionPool
 
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 44 of file ShortcutRepository.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ addShortcut()

bool 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
Returns
‪bool
Exceptions

Definition at line 183 of file ShortcutRepository.php.

References $GLOBALS, TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getBackendUser(), TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getLanguageService(), TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getModuleNameFromRouteIdentifier(), TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\routeExists(), and TYPO3\CMS\Core\Localization\LanguageService\sL().

◆ 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 603 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 135 of file ShortcutRepository.php.

◆ getLanguageService()

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

◆ getModuleNameFromRouteIdentifier()

string 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.

Parameters
string$routeIdentifier
Returns
‪string

Definition at line 682 of file ShortcutRepository.php.

References TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\getRoute(), and TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository\isSpecialRoute().

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

◆ getRoute()

Route null TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::getRoute ( string  $routeIdentifier)
protected

Get the route for a given route identifier

Parameters
string$routeIdentifier
Returns
‪Route|null

Definition at line 698 of file ShortcutRepository.php.

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

◆ 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 80 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 622 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 115 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 ( string  $routeIdentifier,
string  $moduleName,
array  $shortcut 
)
protected

Gets the icon for the shortcut

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

Definition at line 635 of file ShortcutRepository.php.

References TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL.

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

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

◆ initShortcutGroups()

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

◆ initShortcuts()

◆ isSpecialRoute()

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

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

Parameters
string$routeIdentifier
Returns
‪bool

Definition at line 720 of file ShortcutRepository.php.

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

◆ removeShortcut()

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

◆ routeExists()

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

Check if a route for the given identifier exists

Parameters
string$routeIdentifier
Returns
‪bool

Definition at line 709 of file ShortcutRepository.php.

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

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

◆ shortcutExists()

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

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

Parameters
string$routeIdentifier
string$arguments
Returns
‪bool

Definition at line 153 of file ShortcutRepository.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT.

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

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

Member Data Documentation

◆ $connectionPool

ConnectionPool TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository::$connectionPool
protected

◆ $iconFactory

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

◆ $moduleLoader

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

◆ $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 51 of file ShortcutRepository.php.