Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Classes/Backend/Preview/ContentPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* of the License, or any later version.
*/

use B13\Backendpreviews\Service\DatabaseRowService;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\PageLayoutContext;
use TYPO3\CMS\Core\Domain\RecordInterface;
Expand Down Expand Up @@ -54,6 +55,9 @@ public function render(RecordInterface $record, PageLayoutContext $context): ?st
$context->getCurrentRequest()
)
);

$data = GeneralUtility::makeInstance(DatabaseRowService::class)->getAdditionalDataForView($record);
$view->assignMultiple($data);
$view->assign('record', $record);
try {
return $view->render($fluidTemplateName);
Expand Down
28 changes: 28 additions & 0 deletions Classes/Service/DatabaseRowService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Domain\RecordInterface;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\FileRepository;
Expand All @@ -31,6 +32,33 @@
$this->fileRepository = $fileRepository;
}

public function getAdditionalDataForView(RecordInterface $record): array

Check failure on line 35 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Parameter $record of method B13\Backendpreviews\Service\DatabaseRowService::getAdditionalDataForView() has invalid type TYPO3\CMS\Core\Domain\RecordInterface.

Check failure on line 35 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Parameter $record of method B13\Backendpreviews\Service\DatabaseRowService::getAdditionalDataForView() has invalid type TYPO3\CMS\Core\Domain\RecordInterface.
{
$data = [];
if ($this->getBackendUser()->recordEditAccessInternals($record->getMainType(), $record)) {

Check failure on line 38 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (13)

Parameter #2 $row of method TYPO3\CMS\Core\Authentication\BackendUserAuthentication::recordEditAccessInternals() expects array, TYPO3\CMS\Core\Domain\RecordInterface given.

Check failure on line 38 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Parameter #2 $idOrRow of method TYPO3\CMS\Core\Authentication\BackendUserAuthentication::recordEditAccessInternals() expects array|int, TYPO3\CMS\Core\Domain\RecordInterface given.

Check failure on line 38 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Call to method getMainType() on an unknown class TYPO3\CMS\Core\Domain\RecordInterface.

Check failure on line 38 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Parameter #2 $idOrRow of method TYPO3\CMS\Core\Authentication\BackendUserAuthentication::recordEditAccessInternals() expects array|int, TYPO3\CMS\Core\Domain\RecordInterface given.

Check failure on line 38 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Call to method getMainType() on an unknown class TYPO3\CMS\Core\Domain\RecordInterface.

Check failure on line 38 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (13)

Parameter #2 $row of method TYPO3\CMS\Core\Authentication\BackendUserAuthentication::recordEditAccessInternals() expects array, TYPO3\CMS\Core\Domain\RecordInterface given.
$urlParameters = [
'edit' => [
'tt_content' => [
$record->getUid() => 'edit',

Check failure on line 42 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Call to method getUid() on an unknown class TYPO3\CMS\Core\Domain\RecordInterface.

Check failure on line 42 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Call to method getUid() on an unknown class TYPO3\CMS\Core\Domain\RecordInterface.
],
],
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $record->getUid(),

Check failure on line 45 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Call to method getUid() on an unknown class TYPO3\CMS\Core\Domain\RecordInterface.

Check failure on line 45 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Call to method getUid() on an unknown class TYPO3\CMS\Core\Domain\RecordInterface.
];
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);
$return = [
'url' => $url,
'title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:edit')),
];
$data['editLink'] = $return;
}

$data['CType-label'] = $this->getLanguageService()->sL(
BackendUtility::getLabelFromItemListMerged($record->getPid(), 'tt_content', 'CType', $record->get('CType'))

Check failure on line 57 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Call to method getPid() on an unknown class TYPO3\CMS\Core\Domain\RecordInterface.

Check failure on line 57 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Call to method get() on an unknown class TYPO3\CMS\Core\Domain\RecordInterface.

Check failure on line 57 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Call to method getPid() on an unknown class TYPO3\CMS\Core\Domain\RecordInterface.

Check failure on line 57 in Classes/Service/DatabaseRowService.php

View workflow job for this annotation

GitHub Actions / build (12)

Call to method get() on an unknown class TYPO3\CMS\Core\Domain\RecordInterface.
);
return $data;
}

public function extendRow(array $row): array
{
if ($this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
Expand Down
4 changes: 2 additions & 2 deletions Resources/Private/Partials/Link.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
data-namespace-typo3-fluid="true"
>

<f:if condition="{link}">
<f:if condition="{link.url}">
<div class="b_link">
<span class="b_label">{f:translate(key: 'LLL:EXT:backendpreviews/Resources/Private/Language/locallang_db.xlf:link.label')}: </span>{linklabel}
({f:if(condition: '{f:uri.typolink(parameter: link, language: language)}', then: '{f:uri.typolink(parameter: link, language: language)}', else: link)})
({f:if(condition: '{f:uri.typolink(parameter: link.url, language: language)}', then: '{f:uri.typolink(parameter: link.url, language: language)}', else: link.url)})
<f:if condition="{config}">
[{f:translate(key: 'LLL:EXT:backendpreviews/Resources/Private/Language/locallang_db.xlf:link.config')}: {config}]
</f:if>
Expand Down
Loading