Project

General

Profile

Actions

Bug #96077

open

Workspace top bar won't work in multidomain setups

Added by Christian Eßl over 2 years ago. Updated 5 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2021-11-25
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Status quo:
The new workspaces since TYPO3 10.4 uses a hook in the mechanism, that changes the preview urs generated from inside the backend. (For example if you are currently in the workspace and use the "View webpage" button in the Page/List module)
The workspace preview urls work in a way that includes a workspace bar at the top of the previewed page and the frontend page itself inside an iframe.

Problem:
This will not work in multidomain setups, because an active backend login is required and the session is locked to the domain the user used when logged into the backend, not necessarily the same domain used for the frontend preview.
So in this case, another configurable option is required for multidomain setups.

There is already a solution in the core for generating preview urls that are token-based and don't require an active backend login. (which is used by the workspaces module itself) If anyonse else has the problem, right now I am using this PreviewUrl hook for a multidomain setup:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewOnClickClass'][] =
    \Foobar\Hook\PreviewUrlHook::class;
class PreviewUrlHook
{
    public function postProcess($url, $uid)
    {
        $stmt = GeneralUtility::makeInstance(ConnectionPool::class)
            ->getConnectionForTable('pages')
            ->select(['sys_language_uid'], 'pages', [
                'uid'      => $uid,
            ], [], [], 1);
        $page = $stmt->fetch();

        if ($GLOBALS['BE_USER']->workspace !== 0) {
            $url = GeneralUtility::makeInstance(PreviewUriBuilder::class)
                ->buildUriForPage((int)$uid, (int)$page['sys_language_uid']);
        }

        return $url;
    }
}

Of course no workspace bar at the top, but versioned pages can now be previewed by the user, if the domain is different to the backend login.

Actions

Also available in: Atom PDF