4use Bitrix\Main\Page\Asset;
16 private $classList = array();
17 private $dataAttributes = array();
20 private $isDisplayLabel =
true;
24 private $assets = array();
25 private $js = array();
26 private $css = array();
27 private $inline = array();
28 private $jsEvents = array();
29 private $jsEventListeners = array();
31 private $compatibleViewTypes;
33 private $display =
true;
40 return get_called_class();
59 if (is_string($prefix))
61 $prefix =
new Html($prefix);
63 $this->prefix = $prefix;
71 return $this->postfix;
82 if (is_string($postfix))
84 $postfix =
new Html($postfix);
86 $this->postfix = $postfix;
105 foreach ($assets as $key => $assetList)
110 $this->js = array_merge($this->js, $assetList);
113 $this->css = array_merge($this->css, $assetList);
116 $this->
inline = array_merge($this->
inline, $assetList);
119 $this->assets = $assets;
154 foreach ($this->js as $jsPath)
156 Asset::getInstance()->addJs($jsPath);
159 foreach ($this->css as $cssPath)
161 Asset::getInstance()->addCss($cssPath);
164 foreach ($this->
inline as $inline)
167 Asset::getInstance()->addString($inline);
196 return $this->jsEventListeners;
204 return $this->jsEvents;
217 $field->jsEvents[$eventKey][] = array(
218 'behaviourOwner' => $this,
219 'handlerParams' => $jsParams
222 $this->jsEventListeners[$eventKey][] = array(
223 'eventOwner' => $field,
224 'handlerParams' => $jsParams,
245 $this->label = $label;
254 return $this->compatibleViewTypes;
265 $this->compatibleViewTypes = $compatibleViewTypes;
292 return $this->weight;
303 $this->weight = $weight;
315 $this->classList[] = $class;
323 return $this->classList;
334 return !empty($this->dataAttributes[$key]) ? $this->dataAttributes[$key] :
null;
342 return $this->dataAttributes;
353 $this->dataAttributes = $dataAttributes;
363 $this->dataAttributes[$key] = $value;
374 if ($this->
getId() !==
null)
376 $result =
' id="' . $this->
getId() .
'"';
408 $classes = array_filter($classes);
410 if (!empty($classes))
412 $result = !empty($classes) ?
' class="' . implode(
' ', $classes) .
'"' :
'';
426 foreach ($dataAttributes as $key => $value)
428 $result .=
' data-' . $key .
'="' . $value .
'"';
445 foreach ($inlineStyles as $key => $value)
447 $result .=
' ' . $key .
': ' . $value .
';';
460 return $this->isDisplayLabel;
483 $this->inlineStyle[$key] = $value;
490 return $this->inlineStyle;
501 $this->inlineStyle = $inlineStyle;
509 return $this->display;
520 $this->display = $display;
533 $defaultParams = array(
534 'CONFIGURATION_FIELD' => $this,
536 $params = array_merge($defaultParams, $params);
537 $APPLICATION->IncludeComponent(self::FIELDS_COMPONENT_NAME, $templateName, $params);
setDataAttributes($dataAttributes)
getRenderedDataAttributes()
addJsEventListener(Base $field=null, $eventKey, $jsParams)
addDataAttribute($key, $value)
includeFieldComponent($templateName, $params=array())
const FIELDS_COMPONENT_NAME
getRenderedClassAttributes()
addInlineStyle($key, $value)
setIsDisplayLabel($isDisplayLabel)
setInlineStyle($inlineStyle)
setCompatibleViewTypes($compatibleViewTypes)