Documentation

Template

Template class compares placeholders from file (\Bitrix\DocumentGenerator\Body) and how these placeholder's data can be retrieved. Rules for getting the data consist of (with increasing priority) field settings by default, placeholder settings by default (not used), placeholder settings for current template (not used).

Class methods

MethodDescription
loadById($id)Method uploads template from database by its ID $id.
getBody()Method returns an instance \Bitrix\DocumentGenerator\Body.
getFields()Method returns array, where key - placeholder and value is array with description of data retrieval method.
getFileName($prefix = '')Method returns template file name (when downloading). $prefix is added to the name, when is filled.
getDataProviders($combineExtended = false)Method returns list of providers attached to this template.
getUsers()Method returns list of access codes, attached to this template.
setSourceType($sourceType)Method sets the used provider type for this template. Full class name can be passed here. Method must called before creating creating \Bitrix\DocumentGenerator\Document. The method checks comparison of template's provider and module. In case of error - the type is not set.
getSourceType()Method returns a set provider type.
getDownloadUrl($absolute = false)Method returns a download link for template file.
isDeleted()Method returns true, when template is marked as deleted.


© «Bitrix24», 2001-2024
Up