Setting up Custom Attributes on content hierarchy

The setup described below allows to set Custom Attributes (hereafter CAs) on objects of entity Medium. CAs are defined by administrators of tenants and provide an ability to assign an arbitrary JSON value to a Medium obect. That JSON value may have to be required to conform to a specific JSON schema configured at time of CA creation.

Media CAs can also be aggregated over Container hierarchy and computed on objects of entity Container if they conform to specific conditions. If this feature is enabled, they are displayed on content cards via a colored ribbon with a textual label.

Every CA has a default value which is set as part of its definition. Value of CA can be set per tenant and per object. The object value has the highest preference, if it is not set, tenant value is used, and if it is not set either, default value is used. Hence, there is no need to set CA value for every Medium object: defaults are inherited from the higher levels.

  1. Go to Platform Settings - press hamburger menu at the left top corner and select Platform Settings

Step1

  1. Choose Settings.

Step2

  1. Scroll down to Features and enable Custom attributes of media and Custom attributes on content hierarchy

The latter enables assignment of Medium CA to its parent Containers according to specific rules, see below.

Step3

  1. Once the features are enabled, go to Platform settings again and choose CUSTOM ATTRIBUTES => DECLARATIONS

Step4

  1. Fill in Custom attribute definition and press Create:
  • Category -- should be TENANT_MUTABLE_TENANT.
  • CA name may be any not empty string.
  • Entity type should be Medium.
  • Json schema must be a valid JSON schema. Even though arbitrary JSON values can be defined for CAs, in order to be able to compute a CA value over Container hierarchy, it has to contain an enum of strings as one of its attributes. The particular values comprising that enum, none to value5 in this example, do not matter, they can be set either to the actual values, borrowed from the business domain, or set to arbitrary strings, as in this example.
  • Default value -- a string with the default value for the CA, conforming to Json schema.

Step5

  1. To define behavior of CAs on content hierarchy and visual aspects of displaying them, go to Platform settings again and choose Features

Step6

  1. Fill in Custom attribute on content hierarchy definition and press Create:
  • Name -- type any string.
  • Category should be TENANT_MUTABLE_TENANT.
  • CA name -- choose Name of the CA entered at the previous step.
  • Entity type should be Medium.
  • Container value function -- choose MAX_INDEX to use the rightmost value or MIN_INDEX to use the leftmost value of the enum when aggregating CA values over Media belonging to the given Container, see below.
  • Display on content card -- should always be on.
  • Description -- may be empty or any string containing description of this feature config.
  • Custom attribute JSON path -- JSON Path to enum value inside the CA value JSON object.
  • Values -- values that should match JSON Schema defined for the given CA.
  • Labels -- labels to be displayed on Media and Container cards. The number of labels must match the number of values in the enum in the CA definition, binding is performed by the order of elements, i.e. the first value of the enum in the definition of this feature will be mapped to the first value of the enum in the definition of the correspoinding CA, and so on.
  • Colors -- HTML colors for the ribbons on which the labels are displayed. The number of color defenitions must match the number of values, binding is performed by order of elements, same as for Labels.

Step7

It should be noted that values defined here may contain more elements than the JSON Schema definition, and to the contrary, all values defined by schema definition (enum designated by Custom attribute JSON path) must be present in Values here. Hence, to add a new value to the enum, first add it to CUSTOM ATTRIBUTES ON CONTENT HIERARCHY values and after that modify schema of the corresponding CA.
8. After all the above, the default value of CA would be automatically appear on the content cards of all content items.

Step8

  1. To set a different CA value for a given Medium, press gear button on the given Media and choose Manage:

Step9

  1. The CA will appear among regular user attributes. Select label for the given Medium from a dropdown list at EDIT tab and press Save button:

Step10

If you choose Platform default, the value of this CA will be unset for the given Medium.

  1. Verify that labels are displayed correctly for the given Medium and for all Containers containing it, using the appropriate Container value function.