experts!
This is surely a newbie issue, but I am stuck with my project. Problem is this: an array of objects is declared and these objects should have a value when array is declared. Code works ok if values are given in string format, e.g. 'foo bar'. However same array declaration gives me an error if value is set by an function.
Here's the code...
Works ok:
private static $summary_fields = array(
'Title' => 'Title',
'Description' => 'Description',
'SummaryOfPrice' => 'Amount',
'Country.Title' => 'Country'
);
Works NOT ok:
private static $summary_fields = array(
'Title' => _t('FlatFeeShippingRate.DESCRIPTION', 'Title'),
'Description' => _t('FlatFeeShippingRate.DESCRIPTION', 'Description'),
'SummaryOfPrice' => _t('FlatFeeShippingRate.AMOUNT', 'Amount'),
'Country.Title' => _t('FlatFeeShippingRate.COUNTRY', 'Country')
);
Function _t() here is the function that localizes the string. If localized string is not found from .yml-language specific file, it returns the string that is given as the second parameter.
What is wrong with the array declaration when _t() produces an error :
Parse error: syntax error, unexpected '(', expecting ')'
Other places used _t()-function works as charm!
Please help.
Thx!