1

我使用 TYPO3 4.5。需要在扩展类中获取标签TCA记录的文本。我使用 $ GLOBALS [ 'LANG'] -> sL ($ label)。当我登录 BE 时GLOBALS [ 'LANG'],对象 nad 一切正常。但是当注销时, $ GLOBALS [ 'LANG'] = NULL结果会出现错误。$ GLOBALS [ 'LANG'] = not null当我退出时如何制作?

我的代码:

    public function getСolumnValueTca($table,$column,$uid){

    if ($column && $table) {
        $output = null;
        //-----------------------------------
        if ($uid){
            //Ищем нужную запись
            foreach($TCA[$table]['columns'][$column]['config']['items'] as $key => $value){
                if($value['1'] == $uid){
                    $label = $TCA[$table]['columns'] [$column]['config']['items'][$key]['0'];
                    break;
                }
            }
            //------------------------------------------------------------------------------
            if(isset($label)){
                $output[$uid] = array(
                    'value' => $GLOBALS['LANG']->sL($label)
                );
            } else
                $output = false;
        } else {
            //Вытаскиваем все возможные значения
            foreach($TCA[$table]['columns'][$column]['config']['items'] as $key => $value){
                $label = $TCA[$table]['columns'][$column]['config']['items'][$key]['0'];
                $output[$TCA[$table]['columns'][$column]['config']['items'][$key]['1']] = array(
                    'value' => $GLOBALS['LANG']->sL($label)
                );
            }
            //----------------------------------------------------------------------------
        }
    } else
        $output = null;
    return $output;
}
4

1 回答 1

1

尝试以下操作:

$GLOBALS['TSFE']->sL('LLL:EXT:your_ext/pi1/locallang.xml:tx_yourext_pi1.label', 'altIfLabelNotFound'),
于 2016-04-28T08:46:58.847 回答