35 $fields = self::getDocumentSelectFields($fieldType,
true);
38 $result .=
'<select onchange="'.htmlspecialcharsbx($callbackFunctionName).
'(this.options[this.selectedIndex].value)">';
40 $fieldsNames = array_keys($fields);
41 if (!in_array($selectedField, $fieldsNames))
42 $selectedField = isset($fieldsNames[0]) ? $fieldsNames[0] :
'';
44 foreach ($fields as $name => $field)
46 $result .=
'<option value="'.htmlspecialcharsbx($name).
'"'.(($selectedField == $name) ?
" selected" :
"").
'>'
47 .htmlspecialcharsbx($field[
"Name"]).
'</option>';
49 $result .=
'</select>';
51 $result .=
'<!--__defaultOptionsValue:'.$selectedField.
'--><!--__modifyOptionsPromt:'.
Loc::getMessage(
'BPDT_INTERNALSELECT_OPT_LABEL').
'-->';
65 $fields = self::getDocumentSelectFields($fieldType);
68 if (isset($fields[$optionsValue][
'Options']))
70 $options = $fields[$optionsValue][
'Options'];
73 return static::normalizeOptions($options);
81 private static function getDocumentSelectFields(
FieldType $fieldType, $ignoreAliases =
false)
83 $runtime = \CBPRuntime::getRuntime();
84 $runtime->startRuntime();
85 $documentService = $runtime->getService(
"DocumentService");
88 $fields = $documentService->getDocumentFields($fieldType->
getDocumentType());
89 foreach ($fields as $key => $field)
91 if ($field[
'Type'] ==
'select' && mb_substr($key, -10) !=
'_PRINTABLE')
93 $result[$key] = $field;
94 if (isset($field[
'Alias']) && !$ignoreAliases)
95 $result[$field[
'Alias']] = $field;
108 return parent::convertPropertyToView($fieldType, $viewMode, $property);
static loadMessages($file)
static getMessage($code, $replace=null, $language=null)