I use TYPO3 4.5. Need to get the text of label TCA record, in extention class. I use $ GLOBALS [ 'LANG'] -> sL ($ label)
. When I logged in BE GLOBALS [ 'LANG']
is object nad all ok. But when logged out, $ GLOBALS [ 'LANG'] = NULL
in rerult have error.
How to make $ GLOBALS [ 'LANG'] = not null
, when I logget out?
my code:
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;
}
Try following:
$GLOBALS['TSFE']->sL('LLL:EXT:your_ext/pi1/locallang.xml:tx_yourext_pi1.label', 'altIfLabelNotFound'),