Skip to content

Commit

Permalink
Merge branch 'fix/workspace'
Browse files Browse the repository at this point in the history
  • Loading branch information
okmiim committed Feb 5, 2022
2 parents 236fba7 + de8dfc4 commit 4c78609
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Classes/Service/BreadcrumbService.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public function generate(string $content, array $configuration)

protected function getEventByIndex(array $row)
{
return BackendUtility::getRecord($row['foreign_table'], (int)$row['foreign_uid']);
return BackendUtility::getRecordWSOL($row['foreign_table'], (int)$row['foreign_uid']);
}

protected function getIndex(int $uid)
{
return BackendUtility::getRecord('tx_calendarize_domain_model_index', $uid);
return BackendUtility::getRecordWSOL('tx_calendarize_domain_model_index', $uid);
}
}
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/IconForRecordViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function initializeArguments()
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
$arguments['row'] = BackendUtility::getRecord($arguments['table'], $arguments['uid']);
$arguments['row'] = BackendUtility::getRecordWSOL($arguments['table'], $arguments['uid']);
if (!\is_array($arguments['row'])) {
$arguments['row'] = [];
}
Expand Down
74 changes: 60 additions & 14 deletions Classes/Xclass/WorkspaceRemoteServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,73 @@
namespace HDNET\Calendarize\Xclass;

use HDNET\Calendarize\Service\IndexerService;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Workspaces\Controller\Remote\RemoteServer;

class WorkspaceRemoteServer extends RemoteServer
{
public function getWorkspaceInfos($parameter)
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 10) {
// TYPO3 v11 and after
class WorkspaceRemoteServer extends RemoteServer
{
// To avoid too much work we use -1 to indicate that every page is relevant
$pageId = $parameter->id > 0 ? $parameter->id : -1;
if (!isset($parameter->language) || !MathUtility::canBeInterpretedAsInteger($parameter->language)) {
$parameter->language = null;
}
$versions = $this->workspaceService->selectVersionsInWorkspace($this->getCurrentWorkspace(), 0, -99, $pageId, $parameter->depth, 'tables_select', $parameter->language);
/**
* Get List of workspace changes.
*
* @param \stdClass $parameter
*
* @return array $data
*/
public function getWorkspaceInfos($parameter)
{
// To avoid too much work we use -1 to indicate that every page is relevant
$pageId = $parameter->id > 0 ? $parameter->id : -1;
if (!isset($parameter->language) || !MathUtility::canBeInterpretedAsInteger($parameter->language)) {
$parameter->language = null;
}
if (!isset($parameter->stage) || !MathUtility::canBeInterpretedAsInteger($parameter->stage)) {
// -99 disables stage filtering
$parameter->stage = -99;
}
$versions = $this->workspaceService->selectVersionsInWorkspace(
$this->getCurrentWorkspace(),
$parameter->stage,
$pageId,
$parameter->depth,
'tables_select',
$parameter->language
);

// Drop Index Table from View
if (isset($versions[IndexerService::TABLE_NAME])) {
unset($versions[IndexerService::TABLE_NAME]);
}

// Drop Index Table from View
if (isset($versions[IndexerService::TABLE_NAME])) {
unset($versions[IndexerService::TABLE_NAME]);
$data = $this->gridDataService->generateGridListFromVersions($versions, $parameter, $this->getCurrentWorkspace());

return $data;
}
}
} else {
// TYPO3 v10
class WorkspaceRemoteServer extends RemoteServer
{
public function getWorkspaceInfos($parameter)
{
// To avoid too much work we use -1 to indicate that every page is relevant
$pageId = $parameter->id > 0 ? $parameter->id : -1;
if (!isset($parameter->language) || !MathUtility::canBeInterpretedAsInteger($parameter->language)) {
$parameter->language = null;
}
$versions = $this->workspaceService->selectVersionsInWorkspace($this->getCurrentWorkspace(), 0, -99, $pageId, $parameter->depth, 'tables_select', $parameter->language);

// Drop Index Table from View
if (isset($versions[IndexerService::TABLE_NAME])) {
unset($versions[IndexerService::TABLE_NAME]);
}

$data = $this->gridDataService->generateGridListFromVersions($versions, $parameter, $this->getCurrentWorkspace());
$data = $this->gridDataService->generateGridListFromVersions($versions, $parameter, $this->getCurrentWorkspace());

return $data;
return $data;
}
}
}

0 comments on commit 4c78609

Please sign in to comment.