TYPO3挂钩可预览多种语言

时间:2019-04-05 06:35:15

标签: php typo3 extbase

我有使用多种语言的TYPO3安装。 现在,我想创建一个函数,例如,使用法语设置的法语编辑器转到查看(或页面预览)时,他将获得法语版本而不是默认语言。

我的第一个想法是使用PageLayoutViewDrawItemHookInterface,然后更改网址以使用正确的语言

在ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['tx_editordashboard'] =
    \Vendor\Editordashboard\Hooks\Backend\CheckUserCountry::class;

在我的CheckUserCountry.php类中

<?php

namespace TRUMPF\Editordashboard\Hooks\Backend;

use \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface;
use \TYPO3\CMS\Backend\View\PageLayoutView;

class CheckUserCountry implements PageLayoutViewDrawItemHookInterface
{


/**
 * Preprocesses the preview rendering of a content element.
 *
 * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling 
 parent object
 * @param bool $drawItem Whether to draw the item using the default 
functionalities
 * @param string $headerContent Header content
 * @param string $itemContent Item content
 * @param array $row Record row of tt_content
 */
public function preProcess(PageLayoutView &$parentObject, &$drawItem, 
&$headerContent, &$itemContent, array &$row) {echo "bam";}
}

但是,如果我单击“查看”按钮,挂钩将不起作用。有什么想法可以解决问题吗?

0 个答案:

没有答案