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 6 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 #1

Updated by Lidia Demin over 2 years ago

Can confirm this problem on TYPO3 10.4.22. Haven't tested the hook yet, but thanks for sharing your solution!

Actions #2

Updated by Lidia Demin over 2 years ago

Thanks for the hook! Works fine in my multi-tree-multi-domain setup!

Actions #3

Updated by Daniel Haupt 6 months ago

I can confirm this issue for TYPO3 v11.5.33.

The hook is still working as a temporary solution.

Actions

Also available in: Atom PDF