Profile post: added a new Department field

Enhancement request Heading link

Current RED Profile post has an Academic Title field and Alternate Title field plus contact fields, but no Department field. Users wish to add a  Department field to appear in profiles. This would be especially helpful to units with listings across departments.

Solution: some technical details Heading link

To add a new field to Profile post means the new filed description file should be added to Profile object (it defines field mane space and constructor with the fields properties):

wordpress/docroot/wp-content/plugins/uic-red/src/ASF/Fields/ProfileDepartment.php

Department field properties were defined as:

‘key’ => ‘field_profile_department’, ‘label’ => ‘Department’, ‘name’ => ‘department’, ‘type’ => ‘text’, ‘instructions’ => ”, ‘required’ => 0, ‘conditional_logic’ => 0, ‘wrapper’ => array ( ‘width’ => ”, ‘class’ => ”, ‘id’ => ”, ), ‘default_value’ => ”, ‘placeholder’ => ”, ‘prepend’ => ”, ‘append’ => ”, ‘maxlength’ => ”, ‘readonly’ => 0, ‘disabled’ => 0

Also I added the new field to Profile post definition and name space in

wordpress/docroot/wp-content/plugins/uic-red/src/ACF/FieldGroups/Profile.php

Presentation layer should be adjusted in patternlab .twig and .styl files here:

  • /uic-publish/patternlab/patternlab/patterns/core/single-profile.twig
  • /uic-publish/patternlab/patternlab/patterns/core/single-profile.json
  • /uic-publish/patternlab/patternlab/patterns/partials/directory/directory-profile.twig
  • /uic-publish/patternlab/styles/patterns/core/profile.styl

Usage Heading link

This new Department field might be used while creating directory listing structure as well as individual profiles.
It gives you more flexibility and choices (Academic Title, Alternate Title, Department).

See examples on a directory page and click through to see usage in a profile.