Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
text.php
1<?php
3
6
11class Text extends StringType
12{
16 public static function getType()
17 {
18 return FieldType::TEXT;
19 }
20
29 protected static function renderControl(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode)
30 {
31 $isPublic = ($renderMode & FieldType::RENDER_MODE_PUBLIC);
32
33 if ($allowSelection && !$isPublic)
34 {
35 return static::renderControlSelector($field, $value, 'combine', '', $fieldType);
36 }
37
38 $name = static::generateControlName($field);
39 $controlId = static::generateControlId($field);
40 $className = static::generateControlClassName($fieldType, $field);
41
42 $selectorAttributes = '';
43 if ($isPublic && $allowSelection)
44 {
45 $selectorAttributes = sprintf(
46 'data-role="inline-selector-target" data-property="%s" ',
47 htmlspecialcharsbx(Main\Web\Json::encode($fieldType->getProperty()))
48 );
49 }
50
51 return sprintf(
52 '<textarea id="%s" class="%s" placeholder="%s" rows="5" cols="40" name="%s" %s>%s</textarea>',
53 htmlspecialcharsbx($controlId),
54 htmlspecialcharsbx($className),
55 htmlspecialcharsbx($fieldType->getDescription()),
56 htmlspecialcharsbx($name),
57 $selectorAttributes,
58 htmlspecialcharsbx((string)$value)
59 );
60 }
61}
static renderControl(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode)
Definition text.php:29