Configuring and Using the OSF Entity Reference Field Widget

From OSF Wiki
Jump to navigation Jump to search

The OSF Entity Reference and the field widget is a specialized field widget that is used to reference OSF entities one between the other. It let users searching for the entities they want to reference. Then it presents the referenced entities in a series of blue boxes below the entities search bar.

Configuring the OSF Entity Reference Field Widget

To configure the field, you have to click the edit link in the list of fields to manage for an existing content type, or an existing resource type.

Osf field 1.PNG

After clicking the link, you will be redirected to the list of configuration options that are available for this field widget. The first setting that is of interest to us is the Datasets to use when searching for an entity to reference option. In that section, you will have a list of all the datasets currently available to you. Then you will have to select all the datasets that you want to make available to the field widget. This means that if you select the datasets A and B, then when the user will try to reference entities using that field widget, he will only search for entities within the datasets A and B.

Additionally you can do that on the list of loaded ontologies in the Drupal portal.

Osf field 2.PNG

The second setting of interest is the Filter setting. This is a convenient setting that you can use to specify the type of the entities to return when the user is searching for resources to refer to.

The third setting that is of interest is the Number of values setting. This setting restrain the number of values (references) that a user can define for that field.

Finally, when you are done configuring the field widget, you have to click the Save settings button to save the settings you just configured.

Osf field 3.PNG

Using the OSF Entity Field Widget

Once the OSF Entity Field Widget is configured, you can start using it by editing one of your content type or resource type entity. The field widget looks like this:

Osf field 4.PNG

You have 2 main sections with this widget:

  1. The top edit box section that is an autocompletion field what will let you find the entity you want to refer to. Once you start typing a single character, you will start seeing entities results appearing. The search is done on the preferred label of the entities (their names)
  2. The bottom section lists all the entities that have been selected using that field widget. All the blue boxes that are checked will be saved in the system. If an entity is unchecked, then it will appear in yellow and it won't be saved into the system.