def _make_wordmark(entry): fields = entry.fields() product = fields.get("product_icon") if not product: return "" data = { "product_name": product, "product_icon": PRODUCT_THEMES.get(product, ""), "icon_size": WIDTHS.get(fields.get("icon_size"), "") if fields.get("icon_size") else "md", } return render_to_string("includes/contentful/wordmark.html", data, get_current_request())
def _make_cta_button(entry): fields = entry.fields() action = fields.get("action") button_class = [ # TODO, only add on Firefox themed pages "mzp-t-product" if action != "Get Mozilla VPN" else "", "mzp-t-secondary" if fields.get("theme") == "Secondary" else "", f'mzp-t-{WIDTHS.get(fields.get("size"), "")}' if fields.get("size") else "", ] data = { "action": action, "label": fields.get("label"), "button_class": " ".join([_class for _class in button_class if _class]), # TODO "location": "", # eg primary, secondary "cta_text": fields.get("label"), # TODO needs to use English in all locales } return render_to_string("includes/contentful/cta.html", data, get_current_request())