Documentation

GetDisplayValue

array CIBlockFormatProperties::GetDisplayValue(
  array arItem, 
  array arProperty, 
  string event1
)
 

Method assists components in showing element properties. Included into the module to unify display options. Static method.

Call parameters

Parameter Description
arItemArray of element fields.
arProperty Array of property fields (as returned by the method CIBlockElement::GetProperty).
event1 Tag for creating a link event in case when Web analytics module is installed.

When printed value contains 1 value, for example, a file, the method returns a file array. When it contains more values, returns an associative array of file descriptions. When several values are excepted, check in a template, if foreach is required. This applies not only to files, but to all types.

Here is a piece of code responsible for this:
if ($arProperty["PROPERTY_TYPE"]=="F")
     {
      $fileCount = count($arFiles);
      if ($fileCount == 1)
          $arProperty["FILE_VALUE"] = $arFiles[0];
      elseif ($fileCount > 1)
          $arProperty["FILE_VALUE"] = $arFiles;
      else
          $arProperty["FILE_VALUE"] = false;
     }

Returned value

Array of element fields.

Note: method prints only elements active by date in the field DISPLAY_VALUE (uses kernel level filter, that's why standard means cannot be used to print links to inactive elements).



© «Bitrix24», 2001-2024