PreviewBlock extends BaseValuable
Preview block field, contains all exist miniature and functionality to see preview, can toggle to other view type
Table of Contents
Constants
- FIELDS_COMPONENT_NAME = 'bitrix:report.visualconstructor.config.fields'
- JS_EVENT_ON_VIEW_SELECT = 'onSelect'
Methods
- __construct() : mixed
- Preview block field constructor.
- addAssets() : void
- Attach js, css, or inline assets to field.
- addClass() : void
- Add to class list class string.
- addDataAttribute() : void
- addInlineStyle() : void
- Add inline style by key and value.
- addJsEventListener() : $this
- Add js event handler to field on some event which fire on $field in first parameter of this function.
- getAssets() : array<string|int, mixed>
- getClasses() : array<string|int, mixed>
- getClassName() : string
- getCompatibleViewTypes() : array<string|int, mixed>
- getDataAttribute() : mixed|null
- Get data attribute by key.
- getDataAttributes() : array<string|int, mixed>
- getDefaultValue() : mixed
- getForm() : Form
- getId() : string
- getInlineStyle() : array<string|int, mixed>
- getJsEventListeners() : array<string|int, mixed>
- getJsEvents() : array<string|int, mixed>
- getKey() : string
- getLabel() : string
- getName() : string
- getPostfix() : Base
- getPrefix() : Base
- getRenderedClassAttributes() : string
- Convert class list property collection to string for render as html in field element.
- getRenderedDataAttributes() : string
- Conver data atttribute property collection to string for render as html in field element.
- getRenderedIdAttribute() : string
- Conver id property to string for render as html in element.
- getRenderedInlineStyle() : string
- Convert inline style propery collection to string for render as html.
- getValue() : mixed
- Return value if exist, or return default value.
- getWeight() : int
- getWidget() : Widget
- isDisplay() : bool
- isDisplayLabel() : bool
- printContent() : void
- Load field component with label or previewblock template.
- render() : void
- Check is displayable this field, if yes collect all assets, And print content.
- setCompatibleViewTypes() : void
- Setter of compatible widget view types.
- setDataAttributes() : void
- Set Data attributes by array of pair key => values.
- setDefaultValue() : void
- Defaul value setter.
- setDisplay() : void
- Setter for display mode.
- setForm() : void
- Setter for form context.
- setId() : void
- Setter for id.
- setInlineStyle() : void
- Setter dor inline style.
- setIsDisplayLabel() : void
- Setter for display mode of label of field.
- setKey() : void
- Seter for key.
- setLabel() : void
- Setter for field label.
- setName() : void
- Field name setter.
- setPostfix() : void
- Setter for string which render after field content.
- setPrefix() : void
- Setter for string which render before field content.
- setValue() : void
- Value setter.
- setWeight() : void
- Setter for Weight.
- setWidget() : void
- Preview widget setter.
Constants
FIELDS_COMPONENT_NAME
public
mixed
FIELDS_COMPONENT_NAME
= 'bitrix:report.visualconstructor.config.fields'
JS_EVENT_ON_VIEW_SELECT
public
mixed
JS_EVENT_ON_VIEW_SELECT
= 'onSelect'
Methods
__construct()
Preview block field constructor.
public
__construct(mixed $key) : mixed
Default view type is linear graph.
Parameters
- $key : mixed
addAssets()
Attach js, css, or inline assets to field.
public
addAssets(array<string|int, mixed> $assets) : void
Parameters
- $assets : array<string|int, mixed>
-
Array of assets which attach to field.
addClass()
Add to class list class string.
public
addClass(string $class) : void
Parameters
- $class : string
-
Class string.
addDataAttribute()
public
addDataAttribute(string $key, string $value) : void
Parameters
- $key : string
-
Key for data attribute. ('role').
- $value : string
-
Value for data attribute. ('widget').
addInlineStyle()
Add inline style by key and value.
public
addInlineStyle(string $key, string $value) : void
Parameters
- $key : string
-
Key of inline style. ('background-color').
- $value : string
-
Value Of inline style. ('red').
addJsEventListener()
Add js event handler to field on some event which fire on $field in first parameter of this function.
public
addJsEventListener([self|null $field = null ], string $eventKey, array<string|int, mixed> $jsParams) : $this
Parameters
- $field : self|null = null
-
Field which fire event.
- $eventKey : string
-
Event key which listen this field.
- $jsParams : array<string|int, mixed>
-
JS parameters which pass to handler.
Return values
$thisgetAssets()
public
getAssets() : array<string|int, mixed>
Return values
array<string|int, mixed>getClasses()
public
getClasses() : array<string|int, mixed>
Return values
array<string|int, mixed>getClassName()
public
static getClassName() : string
Return values
stringgetCompatibleViewTypes()
public
getCompatibleViewTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>getDataAttribute()
Get data attribute by key.
public
getDataAttribute(string $key) : mixed|null
Parameters
- $key : string
-
Key for data attribute which will return.
Return values
mixed|nullgetDataAttributes()
public
getDataAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getDefaultValue()
public
getDefaultValue() : mixed
getForm()
public
getForm() : Form
Return values
FormgetId()
public
getId() : string
Return values
stringgetInlineStyle()
public
getInlineStyle() : array<string|int, mixed>
Return values
array<string|int, mixed>getJsEventListeners()
public
getJsEventListeners() : array<string|int, mixed>
Return values
array<string|int, mixed>getJsEvents()
public
getJsEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>getKey()
public
getKey() : string
Return values
stringgetLabel()
public
getLabel() : string
Return values
stringgetName()
public
getName() : string
Return values
stringgetPostfix()
public
getPostfix() : Base
Return values
BasegetPrefix()
public
getPrefix() : Base
Return values
BasegetRenderedClassAttributes()
Convert class list property collection to string for render as html in field element.
public
getRenderedClassAttributes() : string
Return values
stringgetRenderedDataAttributes()
Conver data atttribute property collection to string for render as html in field element.
public
getRenderedDataAttributes() : string
Return values
stringgetRenderedIdAttribute()
Conver id property to string for render as html in element.
public
getRenderedIdAttribute() : string
Return values
stringgetRenderedInlineStyle()
Convert inline style propery collection to string for render as html.
public
getRenderedInlineStyle() : string
Return values
stringgetValue()
Return value if exist, or return default value.
public
getValue() : mixed
getWeight()
public
getWeight() : int
Return values
intgetWidget()
public
getWidget() : Widget
Return values
WidgetisDisplay()
public
isDisplay() : bool
Return values
boolisDisplayLabel()
public
isDisplayLabel() : bool
Return values
boolprintContent()
Load field component with label or previewblock template.
public
printContent() : void
Pass available view types list. And prepared widget params to render in preview block.
render()
Check is displayable this field, if yes collect all assets, And print content.
public
render() : void
setCompatibleViewTypes()
Setter of compatible widget view types.
public
setCompatibleViewTypes(array<string|int, mixed> $compatibleViewTypes) : void
Parameters
- $compatibleViewTypes : array<string|int, mixed>
-
Compatible widget view type list.
setDataAttributes()
Set Data attributes by array of pair key => values.
public
setDataAttributes(array<string|int, mixed> $dataAttributes) : void
Parameters
- $dataAttributes : array<string|int, mixed>
-
Array of pair key=>value.
setDefaultValue()
Defaul value setter.
public
setDefaultValue(mixed $defaultValue) : void
Parameters
- $defaultValue : mixed
-
Value which use as default.
setDisplay()
Setter for display mode.
public
setDisplay(bool $display) : void
Parameters
- $display : bool
-
Render or not this field marker.
setForm()
Setter for form context.
public
setForm(Form $form) : void
Parameters
- $form : Form
-
Form where render field.
setId()
Setter for id.
public
setId(string $id) : void
Parameters
- $id : string
-
Unique id.
setInlineStyle()
Setter dor inline style.
public
setInlineStyle(array<string|int, mixed> $inlineStyle) : void
Parameters
- $inlineStyle : array<string|int, mixed>
-
Inline style string.
setIsDisplayLabel()
Setter for display mode of label of field.
public
setIsDisplayLabel(bool $isDisplayLabel) : void
Parameters
- $isDisplayLabel : bool
-
True if label must render else false.
setKey()
Seter for key.
public
setKey(string $key) : void
Parameters
- $key : string
-
Unique key for field.
setLabel()
Setter for field label.
public
setLabel(string $label) : void
Parameters
- $label : string
-
String to set as label for field.
setName()
Field name setter.
public
setName(string $name) : void
Parameters
- $name : string
-
Name which use in rendered field.
setPostfix()
Setter for string which render after field content.
public
setPostfix(string|Base $postfix) : void
Parameters
- $postfix : string|Base
-
String for render after content.
setPrefix()
Setter for string which render before field content.
public
setPrefix(string|Base $prefix) : void
Parameters
- $prefix : string|Base
-
String for render before content.
setValue()
Value setter.
public
setValue(mixed $value) : void
Parameters
- $value : mixed
-
Value set as value of field.
setWeight()
Setter for Weight.
public
setWeight(int $weight) : void
Parameters
- $weight : int
-
Integer of weightof Field.
setWidget()
Preview widget setter.
public
setWidget(Widget $widget) : void
Parameters
- $widget : Widget
-
Widget will render in preview block.