Attribute editors are tools Scrivito presents to users to let them edit attribute content. Scrivito comes with string
, html
, enum
, date
and several other attribute types and includes a default, ready-to-use attribute editor for each of them. For example, strings can be edited using a text input field, enums (pick none or one of several) with a drop-down menu, dates with a date picker, and so on.
Whether you are happy or not with the built-in attribute editors, Scrivito gives you the freedom to write your own ones. Usually, custom attribute editors are specialized tools that you as a developer provide to your users for editing attribute values more intuitively and more comfortably. Custom attribute editors are meant to make it easier for users to understand the options to select from, to give them more context, to help them with making good content decisions.
How do custom editors integrate?
First things first. Let's take a look at how custom editors integrate and how users are supposed to interact with them.
Attribute editors make use of a slim yet powerful Javascript API which is part of the Scrivito SDK. The API consists of functions for fetching attribute values, saving modified values back to Scrivito, searching Scrivito content, creating and deleting content (pages and resources), etc. There are virtually no limits on the API functions you could use in your custom attribute editors.
In general, Scrivito lets users alter attribute values by means of text input areas or drop-down menus, depending on the individual attribute types. So, the main task of an attribute editor is to fetch the current attribute value from Scrivito, to properly show it to the user, to additionally make options, alternatives or help available, to wait for the user to provide input, and finally to save the value back to Scrivito.