Configure Ontologies for Selecting Field Types

From OSF Wiki
Jump to navigation Jump to search

In the process of configuring OSF entities classes and properties, the user specify which classes/properties that will be synchronized as bundles/fields into the Drupal instance. During that process, all the properties will become fields in Drupal.

By default, the field type that is being used by the process is the text one. However, an important feature of OSF for Drupal is to be able to define different field type for every properties you will be synchronizing. This documentation page explains how this feature can be configured and how it will influence the input forms that users will use to define these kind of resources.

Field Types

Supported Field Types

Every property that is mapped into Drupal via OSF Entities will have a field type. Here is the list of field types supported with the Drupal Ontology's related individual:

Field Type Field Type Machine Name Field Type Named Individual
Date date
Date (ISO format) datetime
Date (Unix timestamp) datestamp
Boolean list_boolean
Decimal number_decimal
File file
Image image
Float number_float
List (Float) list_float
List (Integer) list_integer
List (Text) list_text
Link link
Long text and summary text_with_summary
Long text text_textarea
Text text
Geolocation geolocation_latlng

Configuring Ontologies

If you want to change the field types that will be used when you will be synchronizing the properties using OSF Entities, you have to modify the description of the properties, in the loaded ontologies, that will be synchronized.

You have to do this ontologies configuration before doing the OSF Entities mapping.

What we have to do to configure the properties that will be mapped is to specify which field type that should be specified for a given Datatype or Object properties. In this tutorial, we will be using the OSF Ontology module. However, you can do this using Protégé or any other ontologies management tool.

However, if you are not using the OSF Ontology module, what you have to do is to use the property to specify a new annotation to the property you want to specify. Then, the value of that drupal:fieldType annotation should be one of the Field Type Named Individual URI specified above. Then you will have to save your ontology file and to re-import it into OSF using the Ontologies Management Tool or OSF Ontology.

To configure your ontology(ies), you have to go to the Ontologies section, and then to select the ontology where the property you want to update is defined. Once you selected your ontology, click the View/Annotate button. Then click the Properties tab, and search for your property.

Field type config.PNG

Once you see the description of the property you want to update, then click the Advance section such that all the advanced features appears. The first advanced setting is Field Type. This is the one that interest us. Then start typing the name of the field type you want to specify for this property. Once it is selected, click the Save button at the bottom of the page.

Important: make sure that the Drupal Ontology is loaded in your OSF instance before doing these configurations, otherwise nothing will appear in the list of available field types.

Field Widgets

Configuring Field Widgets

Once all the bundles and fields have been created in Drupal using the OSF Entities mapping process, you can continue the configuration process of these fields by specifying the field widgets you want to use for each of them, and then to configure each of these field widgets such that they behave the way you want them to behave.

The first thing to do is to click the field widget's name that appears in the WIDGET column of the list of fields in the bundle you are editing.

Osf entities manage fields widgets.PNG

Then you will be prompted with a list of field widgets that you can use for this field type. Select the one you want to use and save your configuration option. Then Drupal will prompt you with a series of additional configurations that you will be able to configure for that given field widget.

Here is the list of all the field widgets, by field type, that are supported by OSF Entities:

Field Type Field Widget Widget Example
Text Text Field
Img 5.PNG
OSF Entity Reference
Img 20.PNG
OSF Concept Reference (Tagging)
Img 19.PNG
Long text and summary Text area with a summary
Img 17.PNG
Long text Text area (multiple rows)
Img 19.PNG
List (text) Select list
Img 16.PNG
Check boxes/radio buttons
Img 15.PNG
List (integer) Select list
Img 16.PNG
Check boxes/radio buttons
Img 15.PNG
List (float) Select list
Img 16.PNG
Check boxes/radio buttons
Img 15.PNG
Link Link
Img 14.PNG
Integer Text field
Img 5.PNG
Float Text field
Img 5.PNG
Image Image
Img 13.PNG
File File
Img 10.PNG
Entity Reference Select list
Img 7.PNG
Check boxes/radio buttons
Img 6.PNG
Img 8.PNG
Autocomplete (Tags style)
Img 8.PNG
Decimal Text field
Img 5.PNG
Date (Unix timestamp) Text field
Img 3.PNG
Select list
Img 4.PNG
Pop-up calendar
Date (ISO format) Text field
Img 3.PNG
Select list
Img 4.PNG
Pop-up calendar
Date Text field
Img 3.PNG
Select list
Img 4.PNG
Pop-up calendar
Boolean Check boxes/radio buttons
Img 2.PNG
Single on/off checkbox
Img 1.PNG
Geolocation Latitude/Longitude
Img 11.PNG
Google Map
Img 12.PNG