Child pages
  • Automate promo block language image detection [5.3.0-B1]
Skip to end of metadata
Go to start of metadata

The promo block functionality allows to show ads in desired locations on website. To use it:

  1. create promo block group (analog to zone) in the "Website & Content > Promo Blocks" section in Admin Console
  2. go to the "Website & Content > Promo Blocks > Your Promo Block Group" section, that was created in Admin Console
  3. add promo blocks (analog to ads) to the promo block group
  4. 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

  1. create "promo-block:ImageField" tag, that will:
    1. get field name using this code: $field = $this->SelectParam($params, 'name,field');
    2. if "$field" is "false" (means no parameter was given) then use "Image" field name
    3. create "$current_language_field" variable, that would represent field name on current language (e.g. "l3_Image" for "Image" field)
    4. get field value (via "GetDBField" method)
    5. if value found, then set $params['name'] to the "$current_language_field" and return "Field" tag result
    6. set $params['name'] to the field name on primary language and return "Field" tag result

Related Tasks

INP-1547 - Getting issue details... STATUS