registerArgument('row', 'array', 'content data', true); $this->registerArgument('tableName', 'string', 'table name', true); $this->registerArgument('fieldName', 'string', 'field name', true); } /** * Render a constant * * @param array $arguments * @param \Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string Value of constant */ public static function renderStatic( array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext ) { $row = $arguments['row']; $tableName = $arguments['tableName']; $fieldName = $arguments['fieldName']; return self::linkEditContent( BackendUtility::thumbCode(row: $row, table: $tableName, field: $fieldName, linkInfoPopup: false), $row ); } protected static function linkEditContent(string $linkText, $row): string { if (empty($linkText)) { return $linkText; } $backendUser = self::getBackendUser(); if ( $backendUser->check('tables_modify', 'tt_content') && $backendUser->recordEditAccessInternals('tt_content', $row) && ( new Permission( $backendUser->calcPerms(BackendUtility::getRecord('pages', $row['pid']) ?? []) ) )->editContentPermissionIsGranted() ) { $urlParameters = [ 'edit' => [ 'tt_content' => [ $row['uid'] => 'edit', ], ], 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() . '#element-tt_content-' . $row['uid'], ]; /** @var UriBuilder $uriBuilder */ $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters); return '' . $linkText . ''; } return $linkText; } protected static function getBackendUser(): BackendUserAuthentication { return $GLOBALS['BE_USER']; } protected static function getLanguageService(): LanguageService { return $GLOBALS['LANG']; } }