Skip to main content

Introduction

Attributes are an entity that allows you to configure the structure of your application. With them, you can achieve maximum flexibility and eliminate hardcoding.

Attribute sets are similar to a collection of properties, the values of which you can manage through the admin panel. They differ by the type of binding to various entities. You can read more about the types in the section "Types".

An attribute set forms the data structure that can then be used within your project. For example, for a product, you can define that its structure should contain a name, image, price, and text description. At the same time, the structure of a blog post may contain text with a title and a set of images.

Some attributes may be similar in structure and used in different entities, so you can reuse attribute sets for different entities.

Structure

Each attribute set contains a customizable collection of attributes that store the content of your project. You can manage these attributes from the management system. This is convenient, as you no longer need to edit the application code to change your project. Just move all content components that can be changed into attributes.

Markers

Markers cannot contain spaces and cannot start with a digit. If you attempt to enter invalid values in the marker field, the system will ignore the input.

Name

To make it easier for you to navigate, each attribute has a required name parameter, which is a non-unique string. Name the attributes in a way that makes it easy for you to work with them.

Marker

As an identifier, each attribute has a required parameter - "marker", which is a unique string. The marker is also used as a key to access the attributes in your project code. Keep this in mind when setting the attribute marker to avoid syntax conflicts.

Data Type

Choose the data type for each attribute field that it will store.

Data types can be of the following types:

  • String: Simple text, for example, "Hello, world!".
  • Text: Longer text, often formatted, for example, an article or a letter.
  • Text with Header: Text with a header that can be used to denote a topic or category.
  • Integer: An integer, for example, 5, 100, -2.
  • Float: A data type for floating-point numbers that can have a decimal part, for example, 3.14, 1.5, -0.25.
  • Real: The same as Float, but with higher precision.
  • Date and Time: A combination of date and time, for example, 2023-10-27 10:00:00.
  • Date: A date, for example, 2023-10-27.
  • Time: A time, for example, 10:00:00.
  • File: Any file on your computer, for example, a document, image, music.
  • Image: An image, for example, a photograph, drawing.
  • Group of Images: A collection of images, for example, a photo album.
  • Radio Button: A selection button from which only one option can be chosen.
  • List: A list of items, for example, a shopping list.
  • Entity: An entity representing an object from the real world, for example, a person, place, organization.

The content filling interface will correspond to the selected data type for each attribute field.

Opportunities

You can add validators for attributes. This mechanism is discussed in more detail in the section "Validators".

Attributes

If one attribute set is used by several entities at once, you need to be careful when changing the attributes of that set. For example, if you delete one of the attributes, that attribute will be removed everywhere it is used along with the content. If you add a new attribute to the set, that attribute will also be added everywhere the attribute set is used.