What would be the best way to approach allergens, basically making allergen ingredients bold.

If I could add a css selector to each ingredient somehow that would be fantastic, or another approach?

This way when a list of ingredients are shown, allergens are bold and the rest are not but the list basically remains the same.

CommentFileSizeAuthor
#6 2995198-6.patch4.16 KBdcam
#5 2995198-5.patch3.79 KBdcam
#3 2995198-3.patch2.94 KBdcam

Comments

effortDee created an issue. See original summary.

dcam’s picture

Title: Best way to approach allergens » Add the ingredient entity to the field formatter variables
Category: Support request » Task
Priority: Minor » Normal

So the best way would be to add a Boolean field to the ingredients to mark it as an allergen. Then override the field formatter template and conditionally apply a class to the name if the allergen field is checked.

The problem with that idea is that it would require the ingredient entity to be provided as a variable to the template's preprocessor. It isn't. So I'm going to add it so that people can do things like this.

dcam’s picture

Status: Active » Needs review
StatusFileSize
new2.94 KB

Status: Needs review » Needs work

The last submitted patch, 3: 2995198-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dcam’s picture

Status: Needs work » Needs review
StatusFileSize
new3.79 KB
dcam’s picture

StatusFileSize
new4.16 KB

  • dcam committed ec850a7 on 8.x-2.x
    Issue #2995198 by dcam: Add the ingredient entity to the field formatter...
dcam’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.