2namespace Bitrix\Report\VisualConstructor;
4use Bitrix\Main\ArgumentException;
5use Bitrix\Report\VisualConstructor\Fields\Base;
6use Bitrix\Report\VisualConstructor\Fields\Html;
7use Bitrix\Report\VisualConstructor\Internal\Error\Error;
8use Bitrix\Report\VisualConstructor\Internal\Error\IErrorable;
20 private $class =
array();
22 private $postfix =
'';
23 private $dataAttributes =
array();
26 private $fields =
array();
28 private $errors =
array();
37 public function add($field)
39 if (!($field instanceof
Base))
41 $field = $this->convertToField($field);
46 $this->fields[$field->getKey()] = $field;
50 $this->fields[] = $field;
52 $field->setForm($this);
65 if (!($newField instanceof
Base))
67 $newField = $this->convertToField($newField);
70 $indexToInsert =
null;
71 $newFieldsList =
array();
72 foreach ($this->fields as
$key => $field)
74 if ($field === $targetField)
76 $newField->setForm($this);
77 if ($newField->getKey())
79 $newFieldsList[$newField->getKey()] = $newField;
83 $newFieldsList[] = $newField;
86 $newFieldsList[
$key] = $field;
89 $this->fields = $newFieldsList;
101 if (!($newField instanceof
Base))
103 $newField = $this->convertToField($newField);
106 $indexToInsert =
null;
107 $newFieldsList =
array();
108 foreach ($this->fields as
$key => $field)
110 $newFieldsList[
$key] = $field;
111 if ($field === $targetField)
113 $newField->setForm($this);
114 if ($newField->getKey())
116 $newFieldsList[$newField->getKey()] = $newField;
120 $newFieldsList[] = $newField;
125 $this->fields = $newFieldsList;
135 private function convertToField(
$options)
165 if (!isset($fields[
$key]))
167 $this->errors[] =
new Error(
'No field with key:' .
$key);
188 $id = $this->
getId();
192 $dataAttributesString =
'';
193 foreach ($dataAttributes as
$key => $value)
195 $dataAttributesString .=
' data-' .
$key .
'="' . $value .
'" ';
198 $formArguments =
'action="' . (($action !==
null) ? $action :
'#') .
'" ';
199 $formArguments .= ($id !==
null) ?
'id="' . $id .
'" ' :
'';
200 $formArguments .= !empty($class) ?
'class="' . implode(
' ', $class) .
'" ' :
'';
201 $formArguments .= ($name !==
null) ?
'name="' . $name .
'" ' :
'';
202 $formArguments .= $dataAttributesString;
203 echo
'<form ' . $formArguments .
'>';
206 foreach ($fields as
$key => $field)
229 return $this->prefix;
238 $this->prefix = $prefix;
248 return $this->postfix;
257 $this->postfix = $postfix;
267 $this->
class[] = $className;
284 $this->
class = $class;
337 $this->action = $action;
355 $this->method = $method;
364 return $this->dataAttributes;
373 $this->dataAttributes = $dataAttributes;
384 $this->dataAttributes[
$key] = $value;
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
if(empty($signedUserToken)) $key