Documentation

SPA type preset


This class is currently being developed and will be refactored. It's not recommended for direct use.

Class grants access to preset data, as well as for packing/un-packing from json.

Each preset consists from two data "sets".

First set is related to the data in the preset: its name, description, icon and etc.

Second set is the SPA settings preset itself.

SPA settings are applied at the front end via the model.

Class reproduces the \JsonSerializable interface.

Presets are not stored in the database. Set of presets is hardcoded directly in the broker.


Methods


Method Description Available from version
public function __construct(array $fields, array $data)

  • $fields- preset data. The array has the following structure:
    • title - preset name;
    • id - preset ID. Must be constructed based on the rule {venorName}:{code};
    • disabled - flag indicates preset readiness for use;
    • category - string ID for preset section;
    • description - preset description;
    • icon - absolute path to icon.
  • $data- smart process settings. Can contain any fields available for update in camelCase notation.
Constructor.
public static function createFromJson
(string $json): ?TypePreset
When string $json has the correct structure, the method returns new preset object.
public function jsonSerialize(): array
Returns preset description as json.
public function getTitle(): string
Returns preset name.
public function setTitle(string $title): self
Sets preset $title.
public function getCategory(): string
Returns section code.
public function setCategory(string $category): self
Sets $category section code.
public function getDescription(): ?string
Returns preset description.
public function setDescription(string $description): self
Sets preset $description.
public function getIcon(): string
Returns path to icon.
public function setIcon(string $icon): self
Sets path to $icon.
public function getData(): array
Returns SPA settings fields.
public function setData(array $data): self
Sets fields for $data SPA settings.
public function getId(): string
Returns preset ID.
public function setId(string $id): self
Sets preset $id.
public function isDisabled(): bool
Returns preset availability flag.
public function setDisabled(bool $isDisabled): TypePreset
Sets $isDisabled preset availability flag.


© «Bitrix24», 2001-2024