2 namespace TYPO3\CMS\Impexp
;
5 * This file is part of the TYPO3 CMS project.
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
17 use TYPO3\CMS\Core\Imaging\Icon
;
18 use TYPO3\CMS\Core\Imaging\IconFactory
;
19 use TYPO3\CMS\Core\Utility\GeneralUtility
;
22 * Adding Import/Export clickmenu item
28 protected $iconFactory;
33 public function __construct() {
34 $this->iconFactory
= GeneralUtility
::makeInstance(IconFactory
::class);
38 * Processing of clickmenu items
40 * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu $backRef parent
41 * @param array $menuItems Menu items array to modify
42 * @param string $table Table name
43 * @param int $uid Uid of the record
44 * @return array Menu item array, returned after modification
45 * @todo Skinning for icons...
47 public function main(&$backRef, $menuItems, $table, $uid) {
48 $localItems = array();
49 // Show import/export on second level menu OR root level.
50 if ($backRef->cmLevel
&& \TYPO3\CMS\Core\Utility\GeneralUtility
::_GP('subname') == 'moreoptions' ||
$table === 'pages' && $uid == 0) {
51 $LL = $this->includeLL();
52 $urlParameters = array(
56 'id' => ($table == 'pages' ?
$uid : $backRef->rec
['pid'])
58 if ($table == 'pages') {
59 $urlParameters['tx_impexp']['pagetree']['id'] = $uid;
60 $urlParameters['tx_impexp']['pagetree']['levels'] = 0;
61 $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL';
63 $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid;
64 $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL';
66 $url = \TYPO3\CMS\Backend\Utility\BackendUtility
::getModuleUrl('xMOD_tximpexp', $urlParameters);
67 $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export', $LL)), $backRef->excludeIcon($this->iconFactory
->getIcon('actions-document-export-t3d', Icon
::SIZE_SMALL
)), $backRef->urlRefForCM($url), 1);
68 if ($table == 'pages') {
69 $urlParameters = array(
76 $url = \TYPO3\CMS\Backend\Utility\BackendUtility
::getModuleUrl('xMOD_tximpexp', $urlParameters);
77 $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import', $LL)), $backRef->excludeIcon($this->iconFactory
->getIcon('actions-document-import-t3d', Icon
::SIZE_SMALL
)), $backRef->urlRefForCM($url), 1);
80 return array_merge($menuItems, $localItems);
84 * Include local lang file and return $LOCAL_LANG array loaded.
86 * @return array Local lang array
88 public function includeLL() {
89 return $GLOBALS['LANG']->includeLLFile('EXT:impexp/Resources/Private/Language/locallang.xlf', FALSE
);