You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

Remote Attributes

For every relationship in the dynamic schema, Structr automatically provides properties (so-called remote attributes) on the source and target node of the relationship.
Their names are configured in the schema under “Remote Attributes” in the edit-dialogue (see figure 1). Initially their names are generated by simply concatenating the relationship-type and the source/target type name but they can be renamed to more appropriate names (see figure 2).

Figure 1: Initial names of remote attributes
Fig. 1: Initial names of remote attributes

Figure 2: Renamed remote attributes
Fig. 2: Renamed remote attributes

Search results for "Remote Attributes"

Remote Attributes

The Remote Attributes menu provides the bulk editing view for remote attributes. It allows to reset or rename the name of all remote attributes at once.

Type Details Dialog

There are 5 tabs where the functionality of the type can be configured:

  • Local Attributes
    A Custom Type can be extended with dynamic properties to provide the data model for the intended use-case. This list contains all local properties (meaning they are defined on this type directly).

  • Views
    The properties of a type can be combined into named Views, which are accessible under an individual REST URL. Access to these URLs can be configured independently for each HTTP method using Resource Access Grants, which makes them an ideal tool to create specialised endpoints for different client applications (e.g. mobile clients etc.).

  • Methods
    There are different kinds of methods - callback methods and entity methods. Callback methods are automatically executed by the framework upon certain lifecycle events and have a strict naming convention. Entity methods are called by the user/programmer.
    Entity methods are not automatically run by the framework and must be called manually. This either means making a POST request to /structr/rest/<Type>/<UUID>/<methodName> or in serverside JavaScript as <node>.<methodName>();

  • Remote Attributes
    Custom types can be linked to other types, including base types. Structr will automatically create Remote Attributes on either side of the link, which can then be used to create, update or remove the relationships between instances of the two types. In this tab the configuration of the remote attributes can be viewed and edited. The names configured here are used throughout the application to refer to the other side of the relationship(s).

  • Inherited Attributes
    The content of this tab is of informative character. All inherited attributes are shown with an information from where it was inherited.

onSave

The modifications object is a read-only representation of all changes to an object in the current transaction. It consists of 4 elements:

Key Value
after The changed local attributes of the node after the modification
before The previous values of all changed local attributes
added Remote attributes (relationships) that were added
removed Remote attributes (relationships) that were removed

Example 1: The visibility flags visibleToAuthenticatedUsers and visibleToPublicUsers were both set from false to true.

Types

Each Type contains child elements representing it’s Local Attributes, Remote Attributes, Views, Methods and Inherited Attributes. With the exception of Inherited Attributes, which are read-only, all children provide options to mange their respective content.

Local Attributes