Source code for shuup.xtheme.layout._category

from django.utils.translation import gettext_lazy as _

from shuup.xtheme.layout import Layout


[docs] class CategoryLayout(Layout): identifier = "xtheme-category-layout"
[docs] def get_help_text(self, context): category = context.get("category") if not category: return "" return _(f"Content in this placeholder is shown for {category.name} category only.")
[docs] def is_valid_context(self, context): return bool(context.get("category"))
[docs] def get_layout_data_suffix(self, context): return "{}-{}".format(self.identifier, context["category"].pk)