$Text
- is system object, that provides interface for working with multilingual texts. Instance can be obtained in such way:
<?php
$Text = \cs\Text::instance();
$Text
object has next public methods:
- get()
- set()
- del()
- process()
Each method accepts database id as first parameter. This database should contain tables [prefix]text
and [prefix]text_data
with actual structure in order to work properly (primary database already have these tables).
Group - usually module name, or module name plus some section. Label - usually id of some item or section + id. Such structure is made for simpler managing of texts.
Get text by id. In most cases it is not needed because of $Text->process()
method.
Set text for specified group and label.
Delete text for specified group and label.
process($database : int, $data : string|string[], $store_in_cache = false : bool) : false|string|string[]
Process text, and replace {¶([0-9]+)} on real text, is used before showing multilingual information.
Example how it works:
<?php
$Text = \cs\Text::instance();
//Set text by group and label
$result = $Text->set($this->cdb(), 'Blogs/sections/title', $id, $text);
//Process text
$content = $Text->process($this->cdb(), $result);