Source code for shuup.xtheme.extenders
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.template.loader import get_template
from django.utils.safestring import mark_safe
from enumfields import Enum
from shuup.utils.django_compat import reverse
[docs]class FrontMenuExtender(object):
location = MenuExtenderLocation.MAIN_MENU
items = []
menu_item_template = "menu_extension.jinja"
def _get_template(self, theme):
path_template = "shuup/%s/%s"
try:
template_name = path_template % (theme.template_dir, self.menu_item_template)
return get_template(template_name)
except Exception:
template_name = path_template % ("xtheme", "menu_extension.jinja") # super safe fallback
return get_template(template_name)