-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Brigham recently requested that the Spotlight categories be adjusted (this was #65). The branch that responded to that request has now been put into production, which makes the requested change but doesn't (IMO) go far enough. The next time there's a category change, we'll still be on the hook for code-level changes and a re-deploy.
The underlying problem is that we've hard-coded category values in the theme. For example:
https://github.com/MITLibraries/MITLibraries-news/blob/master/inc/spotlights.php#L16-L18
if ( ($field['choices'][ $value ] ) === 'Featured collection' ) {
$featImg ='<div class="or_star-25"></div>';
}
The feature we're looking for is to map an arbitrary list of categories against a list of icons contained in images/sprites.png. This is currently done by looking up the category value within the template, and a long string of if statements in the template.
An alternate model, IMO, would be to maintain the mapping directly within the field itself - so the list of values that is currently:
check : Check it out
collection : Featured collection
exhibit : Featured exhibit
service : Featured service
story : Featured story
video : Featured video
media : In the media
tip : Tip
update : Update
...which are already key/value pairs, could instead be something like:
or_star-25 : Check it out
or_star-25 : Featured collection
or_star-25 : Featured exhibit
or_star-25 : Featured service
or_star-25 : Featured story
or_star-25 : Featured video
or_star-25 : In the media
info : Tip
update : Update
This should allow for site builders to pick the icon they want, and the template could become very simple - just spit out the value for the spotlight in the class attribute.
Thoughts, @PBruk @frrrances ?