mirror of
https://github.com/FriendsOfTYPO3/feedit.git
synced 2024-11-22 14:36:08 +01:00
[TASK] Use proper label shortcut method in adminpanel and feedit
The legacy naming for the shorthand method "extGetLL" was moved to "getLabel" for both the edit toolbar and the EXT:feedit panel. Resolves: #85905 Releases: master Change-Id: I4fdad2127d40cc2850237311f3bc3f56c85ca394 Reviewed-on: https://review.typo3.org/57964 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: Benni Mack <benni@typo3.org>
This commit is contained in:
parent
88cffd4747
commit
7658f63b28
1 changed files with 38 additions and 8 deletions
|
@ -17,6 +17,7 @@ use TYPO3\CMS\Adminpanel\Service\EditToolbarService;
|
||||||
use TYPO3\CMS\Backend\FrontendBackendUserAuthentication;
|
use TYPO3\CMS\Backend\FrontendBackendUserAuthentication;
|
||||||
use TYPO3\CMS\Core\Imaging\Icon;
|
use TYPO3\CMS\Core\Imaging\Icon;
|
||||||
use TYPO3\CMS\Core\Imaging\IconFactory;
|
use TYPO3\CMS\Core\Imaging\IconFactory;
|
||||||
|
use TYPO3\CMS\Core\Localization\LanguageService;
|
||||||
use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
|
use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\CMS\Core\Utility\MathUtility;
|
use TYPO3\CMS\Core\Utility\MathUtility;
|
||||||
|
@ -102,14 +103,14 @@ class FrontendEditPanel
|
||||||
$panel .= $editToolbarService->createToolbar();
|
$panel .= $editToolbarService->createToolbar();
|
||||||
}
|
}
|
||||||
if (isset($allow['edit'])) {
|
if (isset($allow['edit'])) {
|
||||||
$icon = '<span title="' . $this->backendUser->extGetLL('p_editRecord') . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render('inline') . '</span>';
|
$icon = '<span title="' . $this->getLabel('p_editRecord') . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render('inline') . '</span>';
|
||||||
$panel .= $this->editPanelLinkWrap($icon, $formName, 'edit', $dataArr['_LOCALIZED_UID'] ? $table . ':' . $dataArr['_LOCALIZED_UID'] : $currentRecord);
|
$panel .= $this->editPanelLinkWrap($icon, $formName, 'edit', $dataArr['_LOCALIZED_UID'] ? $table . ':' . $dataArr['_LOCALIZED_UID'] : $currentRecord);
|
||||||
}
|
}
|
||||||
// Hiding in workspaces because implementation is incomplete
|
// Hiding in workspaces because implementation is incomplete
|
||||||
if (isset($allow['move']) && $sortField && $this->backendUser->workspace === 0) {
|
if (isset($allow['move']) && $sortField && $this->backendUser->workspace === 0) {
|
||||||
$icon = '<span title="' . $this->backendUser->extGetLL('p_moveUp') . '">' . $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render('inline') . '</span>';
|
$icon = '<span title="' . $this->getLabel('p_moveUp') . '">' . $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render('inline') . '</span>';
|
||||||
$panel .= $this->editPanelLinkWrap($icon, $formName, 'up');
|
$panel .= $this->editPanelLinkWrap($icon, $formName, 'up');
|
||||||
$icon = '<span title="' . $this->backendUser->extGetLL('p_moveDown') . '">' . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render('inline') . '</span>';
|
$icon = '<span title="' . $this->getLabel('p_moveDown') . '">' . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render('inline') . '</span>';
|
||||||
$panel .= $this->editPanelLinkWrap($icon, $formName, 'down');
|
$panel .= $this->editPanelLinkWrap($icon, $formName, 'down');
|
||||||
}
|
}
|
||||||
// Hiding in workspaces because implementation is incomplete
|
// Hiding in workspaces because implementation is incomplete
|
||||||
|
@ -120,17 +121,17 @@ class FrontendEditPanel
|
||||||
$panel .= $this->editPanelLinkWrap($icon, $formName, 'unhide');
|
$panel .= $this->editPanelLinkWrap($icon, $formName, 'unhide');
|
||||||
} else {
|
} else {
|
||||||
$icon = $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL)->render('inline');
|
$icon = $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL)->render('inline');
|
||||||
$panel .= $this->editPanelLinkWrap($icon, $formName, 'hide', '', $this->backendUser->extGetLL('p_hideConfirm'));
|
$panel .= $this->editPanelLinkWrap($icon, $formName, 'hide', '', $this->getLabel('p_hideConfirm'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($allow['new'])) {
|
if (isset($allow['new'])) {
|
||||||
if ($table === 'pages') {
|
if ($table === 'pages') {
|
||||||
$icon = '<span title="' . $this->backendUser->extGetLL('p_newSubpage') . '">'
|
$icon = '<span title="' . $this->getLabel('p_newSubpage') . '">'
|
||||||
. $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL)->render('inline')
|
. $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL)->render('inline')
|
||||||
. '</span>';
|
. '</span>';
|
||||||
$panel .= $this->editPanelLinkWrap($icon, $formName, 'new', $currentRecord, '');
|
$panel .= $this->editPanelLinkWrap($icon, $formName, 'new', $currentRecord, '');
|
||||||
} else {
|
} else {
|
||||||
$icon = '<span title="' . $this->backendUser->extGetLL('p_newRecordAfter') . '">'
|
$icon = '<span title="' . $this->getLabel('p_newRecordAfter') . '">'
|
||||||
. $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render('inline')
|
. $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render('inline')
|
||||||
. '</span>';
|
. '</span>';
|
||||||
$panel .= $this->editPanelLinkWrap($icon, $formName, 'new', $currentRecord, '', $newUID);
|
$panel .= $this->editPanelLinkWrap($icon, $formName, 'new', $currentRecord, '', $newUID);
|
||||||
|
@ -139,10 +140,10 @@ class FrontendEditPanel
|
||||||
// Hiding in workspaces because implementation is incomplete
|
// Hiding in workspaces because implementation is incomplete
|
||||||
// Hiding for localizations because it is unknown what should be the function in that case
|
// Hiding for localizations because it is unknown what should be the function in that case
|
||||||
if (isset($allow['delete']) && $this->backendUser->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
|
if (isset($allow['delete']) && $this->backendUser->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
|
||||||
$icon = '<span title="' . $this->backendUser->extGetLL('p_delete') . '">'
|
$icon = '<span title="' . $this->getLabel('p_delete') . '">'
|
||||||
. $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render('inline')
|
. $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render('inline')
|
||||||
. '</span>';
|
. '</span>';
|
||||||
$panel .= $this->editPanelLinkWrap($icon, $formName, 'delete', '', $this->backendUser->extGetLL('p_deleteConfirm'));
|
$panel .= $this->editPanelLinkWrap($icon, $formName, 'delete', '', $this->getLabel('p_deleteConfirm'));
|
||||||
}
|
}
|
||||||
// Final
|
// Final
|
||||||
$labelTxt = $this->cObj->stdWrap($conf['label'], $conf['label.']);
|
$labelTxt = $this->cObj->stdWrap($conf['label'], $conf['label.']);
|
||||||
|
@ -329,4 +330,33 @@ class FrontendEditPanel
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the label for key. If a translation for the language set in $this->uc['lang']
|
||||||
|
* is found that is returned, otherwise the default value.
|
||||||
|
* If the global variable $LOCAL_LANG is NOT an array (yet) then this function loads
|
||||||
|
* the global $LOCAL_LANG array with the content of "EXT:core/Resources/Private/Language/locallang_tsfe.xlf"
|
||||||
|
* such that the values therein can be used for labels in the Admin Panel
|
||||||
|
*
|
||||||
|
* @param string $key Key for a label in the $GLOBALS['LOCAL_LANG'] array of "EXT:core/Resources/Private/Language/locallang_tsfe.xlf
|
||||||
|
* @return string The value for the $key
|
||||||
|
*/
|
||||||
|
protected function getLabel(string $key): string
|
||||||
|
{
|
||||||
|
if (!is_array($GLOBALS['LOCAL_LANG'])) {
|
||||||
|
$this->getLanguageService()->includeLLFile('EXT:core/Resources/Private/Language/locallang_tsfe.xlf');
|
||||||
|
if (!is_array($GLOBALS['LOCAL_LANG'])) {
|
||||||
|
$GLOBALS['LOCAL_LANG'] = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return htmlspecialchars($this->getLanguageService()->getLL($key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return LanguageService
|
||||||
|
*/
|
||||||
|
protected function getLanguageService(): LanguageService
|
||||||
|
{
|
||||||
|
return $GLOBALS['LANG'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue