Tools
Class Tools Provides various useful methods.
Table of Contents
Constants
- CHECKBOX_VALUE_YES = 'Y'
- IPROPERTY_ENTITY_ELEMENT = 'ELEMENT'
- IPROPERTY_ENTITY_SECTION = 'SECTION'
Methods
- clearCache() : void
- getFieldImageData() : void
- Get image data for element fields.
- getImageSrc() : string
- Get absolute path to image.
- isCheckboxProperty() : bool
- Check if the property is checkbox: - PROPERTY_TYPE === 'L'; - MULTIPLE === 'N'; - LIST_TYPE === 'C'; - Variants amount === 1; - Value of the variant === 'Y'.
- process404() : void
- Performs actions enabled by its parameters.
Constants
CHECKBOX_VALUE_YES
public
mixed
CHECKBOX_VALUE_YES
= 'Y'
IPROPERTY_ENTITY_ELEMENT
public
mixed
IPROPERTY_ENTITY_ELEMENT
= 'ELEMENT'
IPROPERTY_ENTITY_SECTION
public
mixed
IPROPERTY_ENTITY_SECTION
= 'SECTION'
Methods
clearCache()
public
static clearCache() : void
getFieldImageData()
Get image data for element fields.
public
static getFieldImageData(array<string|int, mixed> &$item, array<string|int, mixed> $keys, string $entity[, string $ipropertyKey = 'IPROPERTY_VALUES' ]) : void
Parameters
- $item : array<string|int, mixed>
-
Result CIBlockResult::GetNext/Fetch or _CIBElement::GetFields.
- $keys : array<string|int, mixed>
-
Field keys.
- $entity : string
-
Entity id.
- $ipropertyKey : string = 'IPROPERTY_VALUES'
-
Key with seo data.
getImageSrc()
Get absolute path to image.
public
static getImageSrc(array<string|int, mixed> $image[, bool $safe = true ]) : string
Parameters
- $image : array<string|int, mixed>
-
Image array from CFile::GetFileArray or Tools::getImageData.
- $safe : bool = true
-
Get encode path or unsafe.
Return values
stringisCheckboxProperty()
Check if the property is checkbox: - PROPERTY_TYPE === 'L'; - MULTIPLE === 'N'; - LIST_TYPE === 'C'; - Variants amount === 1; - Value of the variant === 'Y'.
public
static isCheckboxProperty(array<string|int, mixed> $property) : bool
Parameters
- $property : array<string|int, mixed>
-
Property settings.
Return values
boolprocess404()
Performs actions enabled by its parameters.
public
static process404([string $message = "" ][, bool $defineConstant = true ][, bool $setStatus = true ][, bool $showPage = false ][, string $pageFile = "" ]) : void
Parameters
- $message : string = ""
-
Message to show with bitrix:system.show_message component.
- $defineConstant : bool = true
-
If true then ERROR_404 constant defined.
- $setStatus : bool = true
-
If true sets http response status.
- $showPage : bool = false
-
If true then work area will be cleaned and /404.php will be included.
- $pageFile : string = ""
-
Alternative file to /404.php.