我有一个 realurl2 配置,它要求我通过所选语言更改给定类别的标题。关键是只有一个具有类别标题的数据库记录,并且翻译是通过 .xlf 文件进行的。
我现在设法替换了标题,但是映射显然不起作用。realurl 类中是否有一种方法可以轻松添加数据库记录,还是我自己在 $_GET 参数中对其进行解码?
'fixedPostVars' => array(
// TODO: Implement dynamic via typoscript if possible!
'3' => array(
array(
'GETvar' => 'tx_products_products[product_categories]',
'userFunc' => function(&$params, $ref) use ($recordTranslator){
$categoryId = $params['value'];
$translation = $recordTranslator->render('Category', 'title', $categoryId, 'products');
$realUrlConf = new \DmitryDulepov\Realurl\Configuration\ConfigurationReader(0, $params);
$realUrlUtil = new \DmitryDulepov\Realurl\Utility($realUrlConf);
$translation = $realUrlUtil->convertToSafeString($translation);
return $translation;
}
),
这是我到目前为止编码的内容。这里的recordTranslator 只是返回我想在url 中使用的字符串。