Automate promo block language image detection [5.3.0-B1]
The promo block functionality allows to show ads in desired locations on website. To use it:
create promo block group (analog to zone) in the "Website & Content > Promo Blocks" section in Admin Console
go to the "Website & Content > Promo Blocks > Your Promo Block Group" section, that was created in Admin Console
add promo blocks (analog to ads) to the promo block group
in the "Website & Content > Structure & Data" section specify which promo block group is associated with each website page
One of the promo block features is ability to specify different image for each language:
Due technical limitations it's impossible for one field (the image field) to be translatable and allow file upload at the same time. This creates a problem, because there is no way to detect what image needs to be displayed.
Solution
create "
promo-block:ImageField" tag, that will:get field name using this code:
$field = $this->SelectParam($params, 'name,field');if "
$field" is "false" (means no parameter was given) then use "Image" field namecreate "
$current_language_field" variable, that would represent field name on current language (e.g. "l3_Image" for "Image" field)get field value (via "
GetDBField" method)if value found, then set
$params['name']to the "$current_language_field" and return "Field" tag resultset
$params['name']to the field name on primary language and return "Field" tag result