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
6 changes: 5 additions & 1 deletion Build/phpstan-baseline12.neon
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ parameters:

-
message: "#^Call to method getUid\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface\\.$#"
count: 2
count: 4
path: ../Classes/Service/DatabaseRowService.php

-
Expand All @@ -82,3 +82,7 @@ parameters:
message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Imaging\\\\IconProvider\\\\FontawesomeIconProvider not found\\.$#"
count: 2
path: ../Classes/Listener/BootCompleted.php
-
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Backend\\\\View\\\\PageLayoutContext\\:\\:getReturnUrl\\(\\)\\.$#"
count: 1
path: ../Classes/Service/DatabaseRowService.php
2 changes: 1 addition & 1 deletion Classes/Backend/Preview/ContentPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function render(RecordInterface $record, PageLayoutContext $context): ?st
)
);

$data = GeneralUtility::makeInstance(DatabaseRowService::class)->getAdditionalDataForView($record);
$data = GeneralUtility::makeInstance(DatabaseRowService::class)->getAdditionalDataForView($record, $context);
$view->assignMultiple($data);
$view->assign('record', $record);
try {
Expand Down
26 changes: 24 additions & 2 deletions Classes/Service/DatabaseRowService.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

declare(strict_types=1);
Expand All @@ -14,6 +14,7 @@

use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\PageLayoutContext;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Domain\RecordInterface;
use TYPO3\CMS\Core\Information\Typo3Version;
Expand All @@ -32,29 +33,50 @@
$this->fileRepository = $fileRepository;
}

public function getAdditionalDataForView(RecordInterface $record): array
public function getAdditionalDataForView(RecordInterface $record, ?PageLayoutContext $context = null): array
{
$data = [];
if ((new Typo3Version())->getMajorVersion() < 14) {
$editAccess = $this->getBackendUser()->recordEditAccessInternals($record->getMainType(), $record->getRawRecord()->toArray());
} else {
$editAccess = $this->getBackendUser()->recordEditAccessInternals($record->getMainType(), $record);

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

View workflow job for this annotation

GitHub Actions / build (12)

Call to an undefined method TYPO3\CMS\Core\Authentication\BackendUserAuthentication::checkRecordEditAccess().

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

View workflow job for this annotation

GitHub Actions / build (14)

Call to an undefined method TYPO3\CMS\Core\Authentication\BackendUserAuthentication::checkRecordEditAccess().

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

View workflow job for this annotation

GitHub Actions / build (13)

Call to an undefined method TYPO3\CMS\Core\Authentication\BackendUserAuthentication::checkRecordEditAccess().
}
if ($editAccess) {
if ($context === null) {
trigger_error('not passing context is deprecated', E_USER_DEPRECATED);
}
if ($context === null || (new Typo3Version())->getMajorVersion() < 13) {
$returnUrl = GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $record->getUid();
} else {
$returnUrl = $context->getReturnUrl() . '#element-tt_content-' . $record->getUid();
}

$urlParameters = [
'edit' => [
'tt_content' => [
$record->getUid() => 'edit',
],
],
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $record->getUid(),
'returnUrl' => $returnUrl,
];
$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')),
];
if ((new Typo3Version())->getMajorVersion() > 13) {
$urlParameters = [
'edit' => [
'tt_content' => [
$record->getUid() => 'edit',
],
],
'module' => 'web_layout',
'returnUrl' => $returnUrl,
];
$return['contextual'] = (string)GeneralUtility::makeInstance(UriBuilder::class)->buildUriFromRoute('record_edit_contextual', $urlParameters);
}
$data['editLink'] = $return;
}

Expand Down
75 changes: 53 additions & 22 deletions Resources/Private/Layouts/Default.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,58 @@
-->
</f:comment>

<a href="{editLink.url}" title="{editLink.title}">
<f:render section="Fulltype" optional="true">
<span class="b_title">
<f:render section="Type" optional="true">
<f:render partial="Defaults/CTypeLabel" arguments="{_all}"/>
</f:render>
</span><br>
</f:render>
<f:render section="Header" optional="true">
<f:render partial="Defaults/Header" arguments="{_all}" />
</f:render>
<f:render section="Subheader" optional="true">
<f:render partial="Defaults/Subheader" arguments="{_all}" />
</f:render>
<f:render section="Fullmain" optional="true">
<div class="b_content">
<f:render section="Main"/>
</div>
</f:render>
<f:render section="Warnings" optional="true"/>
</a>
<f:if condition="{editLink.contextual}">
<f:then>
<typo3-backend-contextual-record-edit-trigger
url="{editLink.contextual}"
edit-url="{editLink.url}"
title="{editLink.title}"
>
<f:render section="Fulltype" optional="true">
<span class="b_title">
<f:render section="Type" optional="true">
<f:render partial="Defaults/CTypeLabel" arguments="{_all}"/>
</f:render>
</span><br>
</f:render>
<f:render section="Header" optional="true">
<f:render partial="Defaults/Header" arguments="{_all}" />
</f:render>
<f:render section="Subheader" optional="true">
<f:render partial="Defaults/Subheader" arguments="{_all}" />
</f:render>
<f:render section="Fullmain" optional="true">
<div class="b_content">
<f:render section="Main"/>
</div>
</f:render>
<f:render section="Warnings" optional="true"/>
</typo3-backend-contextual-record-edit-trigger>
</f:then>
<f:else>
<f:comment>TYPO3 < v14</f:comment>
<a href="{editLink.url}" title="{editLink.title}">
<f:render section="Fulltype" optional="true">
<span class="b_title">
<f:render section="Type" optional="true">
<f:render partial="Defaults/CTypeLabel" arguments="{_all}"/>
</f:render>
</span><br>
</f:render>
<f:render section="Header" optional="true">
<f:render partial="Defaults/Header" arguments="{_all}" />
</f:render>
<f:render section="Subheader" optional="true">
<f:render partial="Defaults/Subheader" arguments="{_all}" />
</f:render>
<f:render section="Fullmain" optional="true">
<div class="b_content">
<f:render section="Main"/>
</div>
</f:render>
<f:render section="Warnings" optional="true"/>
</a>
</f:else>
</f:if>

</html>

82 changes: 58 additions & 24 deletions Resources/Private/Layouts/DefaultWithLink.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,64 @@
-->
</f:comment>

<a href="{editLink.url}" title="{editLink.title}">
<f:render section="Fulltype" optional="true">
<span class="b_title">
<f:render section="Type" optional="true">
<f:render partial="Defaults/CTypeLabel" arguments="{_all}"/>
</f:render>
</span><br>
</f:render>
<f:render section="Header" optional="true">
<f:render partial="Defaults/Header" arguments="{_all}" />
</f:render>
<f:render section="Subheader" optional="true">
<f:render partial="Defaults/Subheader" arguments="{_all}" />
</f:render>
<f:render section="Fullmain" optional="true">
<div class="b_content">
<f:render section="Main"/>
<f:render section="Link" optional="true">
<f:render partial="Link" arguments="{link: link, linklabel: linklabel, config: linkconfig}" />
</f:render>
</div>
</f:render>
<f:render section="Warnings" optional="true"/>
</a>
<f:if condition="{editLink.contextual}">
<f:then>
<typo3-backend-contextual-record-edit-trigger
url="{editLink.contextual}"
edit-url="{editLink.url}"
title="{editLink.title}"
>
<f:render section="Fulltype" optional="true">
<span class="b_title">
<f:render section="Type" optional="true">
<f:render partial="Defaults/CTypeLabel" arguments="{_all}"/>
</f:render>
</span><br>
</f:render>
<f:render section="Header" optional="true">
<f:render partial="Defaults/Header" arguments="{_all}" />
</f:render>
<f:render section="Subheader" optional="true">
<f:render partial="Defaults/Subheader" arguments="{_all}" />
</f:render>
<f:render section="Fullmain" optional="true">
<div class="b_content">
<f:render section="Main"/>
<f:render section="Link" optional="true">
<f:render partial="Link" arguments="{link: link, linklabel: linklabel, config: linkconfig}" />
</f:render>
</div>
</f:render>
<f:render section="Warnings" optional="true"/>
</typo3-backend-contextual-record-edit-trigger>
</f:then>
<f:else>
<a href="{editLink.url}" title="{editLink.title}">
<f:render section="Fulltype" optional="true">
<span class="b_title">
<f:render section="Type" optional="true">
<f:render partial="Defaults/CTypeLabel" arguments="{_all}"/>
</f:render>
</span><br>
</f:render>
<f:render section="Header" optional="true">
<f:render partial="Defaults/Header" arguments="{_all}" />
</f:render>
<f:render section="Subheader" optional="true">
<f:render partial="Defaults/Subheader" arguments="{_all}" />
</f:render>
<f:render section="Fullmain" optional="true">
<div class="b_content">
<f:render section="Main"/>
<f:render section="Link" optional="true">
<f:render partial="Link" arguments="{link: link, linklabel: linklabel, config: linkconfig}" />
</f:render>
</div>
</f:render>
<f:render section="Warnings" optional="true"/>
</a>
</f:else>
</f:if>

</html>

Loading