-
Notifications
You must be signed in to change notification settings - Fork 0
HykuAddons: Working with non schema worktypes[WIP]
Below are the steps for adding a new field to an existing non schema worktype. Please refer to this pull request which is an example of adding the field repository_space to the Anschutz worktype, links
-
Find appropriate RDF predicate
Using the list of RDF vocabs here find a predicate that matches the data that you are creating a field for. Make sure that the predicate is not one that is already in use for another field as this will cause the data to save over the old field. -
Add the new field to the model
Find the model of the worktype you are adding the field to, in the above example it is Anschutz Work model -
Add the new field to the work types work form
Find the work form for the worktype you are adding the field too. Add the name of the field in theadd_termsarray of the form. Place it in the position you want it to appear on the form as the order of this array determines the order of the fields on the form. Add the field to the list of permitted params and if you want it to be required also add it into therequired_fieldsarray. If the field needs to be above the "Additional fields" section of the deposit form, add the field to the array in theprimary_termsmethod -
Add the field to general work_form and solr_document
For the field to appear on the worktypes deposit form, it needs to be added to theavalible_termsarray in the work_form file which is included in all worktype specific forms. The field also need to be added to the solr_document_behavior. -
If the field is a drop down field, add a service and authority
All of the services follow the exact same format and are found in this folder. To populate the drop down, add an authority in the authorities folder. The file should follow the naming conventionfield_name-TENANTNAMEorfield_name-WORK_TYPE. You will need to run the Hyku Addons installer again for the new authority to be registered. -
Create a view partial for the new fields
The view partials are found here -
Add field to work API
Add the field the the work api