2016-11-22 82 views
1

我正在使用基于LLL翻译的默认字段。TYPO3 CMS 7.6 LLL翻译在默认情况下不工作

'default' => 'LLL:EXT:myext/Resources/Private/Language/Backend.xlf:field.myfield.default', 

我希望在翻译中定义的值,但它包含字符串 '' LLL:EXT:myext /资源/私人/语言/ Backend.xlf:field.myfield.default”。我如何使用LLL Translation来定义TCA中的默认值?

铜n00n

回答

2

这通过一个自定义FormProvider为核心,不支持此尚的一个是唯一可能的。结帐代码

 // Special handling for eval null 
     if (!empty($fieldConfig['config']['eval']) && GeneralUtility::inList($fieldConfig['config']['eval'], 'null')) { 
      if (// Field exists and is set to NULL 
       array_key_exists($fieldName, $databaseRow) 
       // Default NULL is set, and this is a new record! 
       || (array_key_exists('default', $fieldConfig['config']) && $fieldConfig['config']['default'] === null) 
      ) { 
       $newRow[$fieldName] = null; 
      } else { 
       $newRow[$fieldName] = (string)$fieldConfig['config']['default']; 
      } 
     } else { 
      // Fun part: This forces empty string for any field even if no default is set. Unsure if that is a good idea. 
      $newRow[$fieldName] = (string)$fieldConfig['config']['default']; 
     } 

您可以在https://forge.typo3.org/projects/typo3cms-core/issues处打开问题。

与此同时,我做了一个小扩展,使它可以使用所需的功能。这可以在这里找到:https://github.com/georgringer/defaultlll

+0

如何使用自定义表单提供程序?对不起,刚开始使用T3 4周前... – n00n

+0

对不起,迟到了。我为你做了一个小扩展,查看https://github.com/georgringer/defaultlll。我也采纳了答案,以便您将其标记为解决方案 –