Commit f818a6d2 authored by Anja Leichsenring's avatar Anja Leichsenring Committed by Andreas Fernandez
Browse files

[TASK] Remove AbstractToolbarItem class

The Abstract is only implemented by one single class, so it is pretty useless.
The functionality is moved to the actual class, and the Abstract is removed.

Change-Id: I61e5d2cabd7458c7963d3223e7ed11d49a3f1f41
Releases: master
Resolves: #67788
Reviewed-on: http://review.typo3.org/40698


Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarDavid Greiner <hallo@davidgreiner.de>
Tested-by: default avatarDavid Greiner <hallo@davidgreiner.de>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
parent 2e58197e
<?php
namespace TYPO3\CMS\Backend\Backend\ToolbarItems;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
/**
* Render system info toolbar item
*/
abstract class AbstractToolbarItem {
/**
* @var StandaloneView
*/
protected $standaloneView = NULL;
public function __construct() {
$extPath = ExtensionManagementUtility::extPath('backend');
/* @var $view StandaloneView */
$this->standaloneView = GeneralUtility::makeInstance(StandaloneView::class);
$this->standaloneView->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/ToolbarMenu/' . static::TOOLBAR_MENU_TEMPLATE);
}
/**
* @param string $extension Set the extension context (required for shorthand locallang.xlf references)
* @return StandaloneView
*/
protected function getStandaloneView($extension = NULL) {
if (!empty($extension)) {
$request = $this->standaloneView->getRequest();
$request->setControllerExtensionName($extension);
}
return $this->standaloneView;
}
}
......@@ -20,13 +20,20 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Http\AjaxRequestHandler;
use TYPO3\CMS\Core\Utility\CommandUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
/**
* Render system info toolbar item
*/
class SystemInformationToolbarItem extends AbstractToolbarItem implements ToolbarItemInterface {
class SystemInformationToolbarItem implements ToolbarItemInterface {
/**
* @var StandaloneView
*/
protected $standaloneView = NULL;
/**
* Template file for the dropdown menu
......@@ -77,7 +84,10 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
return;
}
parent::__construct();
$extPath = ExtensionManagementUtility::extPath('backend');
/* @var $view StandaloneView */
$this->standaloneView = GeneralUtility::makeInstance(StandaloneView::class);
$this->standaloneView->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/ToolbarMenu/' . static::TOOLBAR_MENU_TEMPLATE);
$pageRenderer = $this->getPageRenderer();
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/SystemInformationMenu');
......@@ -280,14 +290,16 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
return '';
}
$this->getStandaloneView('backend')->assignMultiple(array(
$request = $this->standaloneView->getRequest();
$request->setControllerExtensionName('backend');
$this->standaloneView->assignMultiple(array(
'installToolUrl' => BackendUtility::getModuleUrl('system_InstallInstall'),
'messages' => $this->systemMessages,
'count' => $this->totalCount,
'severityBadgeClass' => $this->severityBadgeClass,
'systemInformation' => $this->systemInformation
));
return $this->getStandaloneView()->render();
return $this->standaloneView->render();
}
/**
......@@ -367,5 +379,4 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
}
return $this->signalSlotDispatcher;
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment