Skip to content
This repository was archived by the owner on May 17, 2026. It is now read-only.

HykuAddons: Working with non schema worktypes[WIP]

Bertie Wooles edited this page Feb 28, 2022 · 5 revisions

Adding a new field to a non schema worktype

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

  1. 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.

  2. 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

  3. 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 the add_terms array 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 the required_fields array. If the field needs to be above the "Additional fields" section of the deposit form, add the field to the array in the primary_terms method

  4. 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 the avalible_terms array 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.

  5. 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 convention field_name-TENANTNAME or field_name-WORK_TYPE. You will need to run the Hyku Addons installer again for the new authority to be registered.

  6. Create a view partial for the new fields
    The view partials are found here

  7. Add field to work API
    Add the field the the work api

Clone this wiki locally