{% extends 'pages/portal/default.twig' %} {% set slug = slug|slugify %} {% set options = options|default({}) + { taxonomy_pool: false, taxonomy_length: 12, taxonomy_params: [], portal_highlight: false, page_variant: 'taxonomy', portal_teaser_fixed: false, list_loadmore_url: url('designs:pagedsimple:view', {taxonomytype: taxonomy.singular_slug, slug: slug, page: 2}), list_loadmore_url_ajax: url('designs:pagedsimple:view', {taxonomytype: taxonomy.singular_slug, slug: slug, page: 'PAGE'}), } %} {# Required variables # record - the portal page itself otherwise a fake recored wil be created for the taxonomy # objects - array of content objects (records) to display in teaserlist (optional, can select it's own records via pool parameters) # teasers - array of teasers in addition converted objects above (optional, will use it's own records) #} {# --- Logic -------------------------------------------------------------------------------------------------------- #} {# Replace broken Bolt taxonomy logic with corrected data - NOTE: This requires the taxonomies module #} {% set taxonomy = Taxonomies.getTaxonomy(taxonomy.singular_slug, slug) %} {% set slug = taxonomy.selected_slug|default(slug) %} {# Search for replacement record for this taxonomy #} {% set contenttype = options.taxonomy_contenttype %} {% setcontent record = contenttype where {'slug': slug} returnsingle %} {# if no record found for taxonomy, create a fake record object #} {% if not record|default %} {% set record = app.storage.getContentObject(contenttype,{ 'title': taxonomy.selected_name|default(slug), 'status': 'published', }) %} {% set res = record.setTaxonomy(taxonomy.slug, slug, taxonomy.selected_name|default(slug)) %} {% endif %} {# load records for taxonomy page #} {% if options.taxonomy_pool %} {% set objects = [] %} {# This call disabled adding items to shownItems since next page will have an offset for that #} {% set items = RelationFill.getItems(options.taxonomy_pool, options.taxonomy_length, options.taxonomy_params + { (taxonomy.singular_slug): slug }, [], 'default', false) %} {% for item in items %} {% set objects = objects|merge([item.object]) %} {% endfor %} {% else %} {% set objects = records %} {% endif %}