Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
[TASK] Push current state of DEV-server to Gitlab EAP
Browse files Browse the repository at this point in the history
Change-Id: I1a9a8e780d20af9ca59c3ab9b6180d6edb7fae2d
  • Loading branch information
Bunnyfield committed Oct 27, 2018
1 parent 674f52a commit f3ab4d2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 58 deletions.
19 changes: 1 addition & 18 deletions Classes/ContextMenu/ItemProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,10 @@
*/

use TYPO3\CMS\Backend\ContextMenu\ItemProviders\RecordProvider;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class ItemProvider extends RecordProvider
{
/**
* @var UriBuilder
*/
protected $uriBuilder;

/**
* @var array
*/
protected $itemsConfiguration = [
'pastereference' => [
'type' => 'item',
Expand All @@ -42,12 +32,10 @@ class ItemProvider extends RecordProvider
/**
* @param array $items
* @return array
* @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
*/
public function addItems(array $items): array
{
$this->initialize();
$this->uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);

if (isset($items['pasteAfter'])) {
$localItems = $this->prepareItems($this->itemsConfiguration);
Expand All @@ -62,11 +50,6 @@ public function addItems(array $items): array
return $items;
}

/**
* @param string $itemName
* @return array
* @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
*/
protected function getAdditionalAttributes(string $itemName): array
{
$urlParameters = [
Expand All @@ -87,7 +70,7 @@ protected function getAdditionalAttributes(string $itemName): array
$attributes = $this->getPasteAdditionalAttributes('after');
$attributes += [
'data-callback-module' => 'TYPO3/CMS/Gridelements/ClickMenuActions',
'data-action-url' => htmlspecialchars($this->uriBuilder->buildUriFromRoute('tce_db', $urlParameters)),
'data-action-url' => htmlspecialchars(BackendUtility::getModuleUrl('tce_db', $urlParameters)),
];
return $attributes;
}
Expand Down
41 changes: 18 additions & 23 deletions Classes/Hooks/DrawItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use GridElementsTeam\Gridelements\Backend\LayoutSetup;
use GridElementsTeam\Gridelements\Helper\Helper;
use TYPO3\CMS\Backend\Controller\PageLayoutController;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\PageLayoutView;
use TYPO3\CMS\Backend\View\PageLayoutViewDrawFooterHookInterface;
Expand Down Expand Up @@ -92,11 +91,6 @@ class DrawItem implements PageLayoutViewDrawItemHookInterface, SingletonInterfac
*/
protected $tree;

/**
* @var UriBuilder
*/
protected $uriBuilder;

/**
* @var bool
*/
Expand All @@ -113,7 +107,6 @@ public function __construct()
$this->setLanguageService($GLOBALS['LANG']);
$this->helper = Helper::getInstance();
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$this->uriBuilder= GeneralUtility::makeInstance(UriBuilder::class);
$this->cleanupCollapsedStatesInUC();
}

Expand Down Expand Up @@ -259,7 +252,7 @@ protected function setMultipleColPosValues($parserRows, &$colPosValues, $layout)
foreach ($parserRows as $parserRow) {
if (is_array($parserRow['columns.']) && !empty($parserRow['columns.'])) {
foreach ($parserRow['columns.'] as $parserColumns) {
$name = $this->languageService->sL($parserColumns['name']);
$name = $this->languageService->sL($parserColumns['name'], true);
if (isset($parserColumns['colPos']) && $parserColumns['colPos'] !== '') {
$columnKey = (int)$parserColumns['colPos'];
$colPosValues[$columnKey] = [
Expand Down Expand Up @@ -557,7 +550,7 @@ protected function renderSingleGridColumn(
'uid_pid' => $parentObject->id,
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'),
];
$url = $this->uriBuilder->buildUriFromRoute('new_content_element', $urlParameters);
$url = BackendUtility::getModuleUrl('new_content_element', $urlParameters);
} else {
$urlParameters = [
'edit' => [
Expand All @@ -577,7 +570,7 @@ protected function renderSingleGridColumn(
],
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'),
];
$url = $this->uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
$url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
}
}
}
Expand All @@ -586,8 +579,9 @@ protected function renderSingleGridColumn(

if ($colPos !== '' && $colPos !== null && $colPos < 32768 && $url) {
$iconsArray = [
'new' => '<a href="' . htmlspecialchars($url) . '" title="' . $this->languageService->getLL('newContentElement') . '" class="btn btn-default btn-sm">'
. $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL) . ' ' . $this->languageService->getLL('content') . '</a>',
'new' => '<a href="' . htmlspecialchars($url) . '" title="' . $this->languageService->getLL('newContentElement',
true) . '" class="btn btn-default btn-sm">' . $this->iconFactory->getIcon('actions-document-new',
'small') . ' ' . $this->languageService->getLL('content', true) . '</a>',
];
}

Expand Down Expand Up @@ -656,7 +650,7 @@ class="t3js-sortable t3js-sortable-lang t3js-sortable-lang-' . $row['sys_languag
'uid_pid' => -$specificIds['uid'],
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'),
];
$url = $this->uriBuilder->buildUriFromRoute('new_content_element', $urlParameters);
$url = BackendUtility::getModuleUrl('new_content_element', $urlParameters);
} else {
$urlParameters = [
'edit' => [
Expand All @@ -676,15 +670,15 @@ class="t3js-sortable t3js-sortable-lang t3js-sortable-lang-' . $row['sys_languag
],
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'),
];
$url = $this->uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
$url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
}
$iconsArray = [
'new' => '<a
href="' . htmlspecialchars($url) . '"
title="' . $this->languageService->getLL('newContentElement') . '"
title="' . $this->languageService->getLL('newContentElement', true) . '"
class="btn btn-default btn-sm">' .
$this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL) . ' ' .
$this->languageService->getLL('content') .
$this->iconFactory->getIcon('actions-document-new', 'small') . ' ' .
$this->languageService->getLL('content', true) .
'</a>',
];
}
Expand Down Expand Up @@ -737,7 +731,7 @@ protected function checkIfTranslationsExistInLanguage(
// Also, you may override this strict behavior via user TS Config
// If you do so, you're on your own and cannot rely on any support by the TYPO3 core
// We jump out here since we don't need to do the expensive loop operations
$allowInconsistentLanguageHandling = BackendUtility::getPagesTSconfig($parentObject->id,
$allowInconsistentLanguageHandling = BackendUtility::getModTSconfig($parentObject->id,
'mod.web_layout.allowInconsistentLanguageHandling');
if ($language === 0 || $language === -1 || $allowInconsistentLanguageHandling['value'] === '1') {
return false;
Expand Down Expand Up @@ -856,7 +850,7 @@ protected function tt_content_drawFooter(PageLayoutView $parentObject, array $ro
$drawFooterHooks = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawFooter'];
if (is_array($drawFooterHooks)) {
foreach ($drawFooterHooks as $hookClass) {
$hookObject = GeneralUtility::makeInstance($hookClass);
$hookObject = GeneralUtility::getUserObj($hookClass);
if (!$hookObject instanceof PageLayoutViewDrawFooterHookInterface) {
throw new \UnexpectedValueException($hookClass . ' must implement interface ' . PageLayoutViewDrawFooterHookInterface::class,
1404378171);
Expand Down Expand Up @@ -920,8 +914,9 @@ protected function tt_content_drawColHeader($colName, $editParams, PageLayoutVie
if ($parentObject->tt_contentConfig['showCommands']) {
// Edit whole of column:
if ($editParams) {
$iconsArr['edit'] = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($editParams)) . '" title="' . $this->getLanguageService()->getLL('editColumn') . '">'
. $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
$iconsArr['edit'] = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($editParams)) . '" title="' . $this->getLanguageService()->getLL('editColumn',
true) . '">' . $this->iconFactory->getIcon('actions-document-open',
Icon::SIZE_SMALL)->render() . '</a>';
}
}

Expand All @@ -936,8 +931,8 @@ protected function tt_content_drawColHeader($colName, $editParams, PageLayoutVie
}

$iconsArr['toggleContent'] = '<a href="#" class="btn btn-default t3js-toggle-gridelements-column toggle-content" title="' . $title . '" data-toggle-title="' . $toggleTitle . '" data-state="' . $state . '">' . $this->iconFactory->getIcon('actions-view-list-collapse',
Icon::SIZE_SMALL) . $this->iconFactory->getIcon('actions-view-list-expand',
Icon::SIZE_SMALL) . '</a>';
'small') . $this->iconFactory->getIcon('actions-view-list-expand',
'small') . '</a>';
$icons = '<div class="t3-page-column-header-icons btn-group btn-group-sm">' . implode('',
$iconsArr) . '</div>';
// Create header row:
Expand Down
12 changes: 1 addition & 11 deletions Classes/Hooks/PageRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use GridElementsTeam\Gridelements\Backend\LayoutSetup;
use TYPO3\CMS\Backend\Clipboard\Clipboard;
use TYPO3\CMS\Backend\Controller\PageLayoutController;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\BackendLayoutView;
use TYPO3\CMS\Core\Imaging\Icon;
Expand All @@ -41,19 +40,11 @@
*/
class PageRenderer implements SingletonInterface
{

/**
* @var UriBuilder
*/
protected $uriBuilder;


/**
* wrapper function called by hook (\TYPO3\CMS\Core\Page\PageRenderer->render-preProcess)
*
* @param array $parameters An array of available parameters
* @param \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer The parent object that triggered this hook
* @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
*/
public function addJSCSS(array $parameters, \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer)
{
Expand All @@ -64,7 +55,6 @@ public function addJSCSS(array $parameters, \TYPO3\CMS\Core\Page\PageRenderer $p
}
if (!empty($GLOBALS['SOBE']) && (get_class($GLOBALS['SOBE']) === PageLayoutController::class || is_subclass_of($GLOBALS['SOBE'],
PageLayoutController::class))) {
$this->uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsOnReady');
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsDragDrop');
Expand Down Expand Up @@ -117,7 +107,7 @@ public function addJSCSS(array $parameters, \TYPO3\CMS\Core\Page\PageRenderer $p
$GLOBALS['TYPO3_CONF_VARS']['BE']['explicitADmode']) ? 'true' : 'false') . ";
top.skipDraggableDetails = " . ($this->getBackendUser()->uc['dragAndDropHideNewElementWizardInfoOverlay'] ? 'true' : 'false') . ";
top.backPath = '" . $GLOBALS['BACK_PATH'] . "';
top.browserUrl = '" . $this->uriBuilder->buildUriFromRoute('wizard_element_browser') . "';";
top.browserUrl = '" . BackendUtility::getModuleUrl('wizard_element_browser') . "';";

if (!empty($clipBoard) && !empty($clipBoard['el'])) {
$clipBoardElement = GeneralUtility::trimExplode('|', key($clipBoard['el']));
Expand Down
12 changes: 6 additions & 6 deletions Classes/Wizard/GridelementsBackendLayoutWizardElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ public function render()
if (!empty($item[1])) {
$contentType['key'] = $item[1];
if (substr($contentType['key'], 0, 2) !== '--') {
$contentType['label'] = $lang->sL($item[0]);
$contentType['label'] = $lang->sL($item[0], true);
if (strpos($item[2], 'EXT:') === 0) {
$contentType['icon'] = GeneralUtility::getFileAbsFileName($item[2]);
$contentType['icon'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($item[2]);
} elseif (strpos($item[2], '/typo3') === 0) {
$contentType['icon'] = '../../../' . $item[2];
} else {
Expand All @@ -160,9 +160,9 @@ public function render()
if (!empty($item[1])) {
$listType['key'] = $item[1];
if (substr($listType['key'], 0, 2) !== '--') {
$listType['label'] = $lang->sL($item[0]);
$listType['label'] = $lang->sL($item[0], true);
if (strpos($item[2], 'EXT:') === 0) {
$listType['icon'] = GeneralUtility::getFileAbsFileName($item[2]);
$listType['icon'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($item[2]);
} elseif (strpos($item[2], '/typo3') === 0) {
$listType['icon'] = '../../../' . $item[2];
} else {
Expand All @@ -186,10 +186,10 @@ public function render()
if (!empty($key)) {
$gridType['key'] = $key;
if (substr($gridType['key'], 0, 2) !== '--') {
$gridType['label'] = $lang->sL($item['title']);
$gridType['label'] = $lang->sL($item['title'], true);
if (!empty($item['icon']) && is_array($item['icon']) && !empty($item['icon'][0])) {
if (strpos($item['icon'][0], 'EXT:') === 0) {
$gridType['icon'] = GeneralUtility::getFileAbsFileName($item['icon']);
$gridType['icon'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($item['icon']);
} elseif (strpos($item['icon'][0], '/typo3') === 0) {
$gridType['icon'] = '../../../' . $item['icon'];
} else {
Expand Down

0 comments on commit f3ab4d2

Please sign in to comment.