Index

<!-- Error rendering component -->
<!-- TwigException: Unable to parse 'paginate entries.limit(8) as pagination, caseStudies' -->
<!-- Error: TwigException: Unable to parse 'paginate entries.limit(8) as pagination, caseStudies'
    at /opt/build/repo/node_modules/@frctl/twig/src/adapter.js:156:24
    at new Promise (<anonymous>)
    at TwigAdapter.render (/opt/build/repo/node_modules/@frctl/twig/src/adapter.js:134:16)
    at ComponentSource._renderVariant (/opt/build/repo/node_modules/@frctl/fractal/src/api/components/source.js:212:30)
    at _renderVariant.next (<anonymous>)
    at onFulfilled (/opt/build/repo/node_modules/co/index.js:65:19) -->
{% extends '_layouts/default' %}

{% set sectorParam = craft.app.request.param('sector') %}
{% set filteredSector = craft.categories.group('sectors').slug(sectorParam) %}
{% set allEntries = craft.entries.section('caseStudies') %}
{% if sectorParam is not empty %}
  {% set entries =
    clone(allEntries).relatedTo({
      targetElement: filteredSector
    })
  %}
{% else %}
  {% set entries = clone(allEntries) %}
{% endif %}
{% paginate entries.limit(8) as pagination, caseStudies %}
{% set isPaginated = pagination.currentPage > 1 %}

{% set dropDownItems = [
  {
    value: '/work',
    label: 'All case studies',
    selected: sectorParam is empty
  }
] %}

{% for sector in craft.categories.group('sectors') %}
  {% set entriesInSector =
    clone(allEntries).relatedTo({
      targetElement: sector
    })
  %}

  {% if entriesInSector.count > 0 %}
    {% set dropDownItems =
      dropDownItems|merge(
        [
          {
            value: ['/work?sector=', sector.slug]|join,
            label: sector.title ~ ' (' ~ entriesInSector.count ~ ')',
            selected: sectorParam == sector.slug
          }
        ]
      )
    %}
  {% endif %}
{% endfor %}

{% set pageHeaderContent = {
  title: entry.altTitle
    ? {
      lines: entry.altTitle|split('\n')
    }
    : {
      text: entry.title
    },
  content: {
    subtitle: entry.subtitle,
    standfirst: {
      text: entry.heroContent
    }
  }
} %}

{% if isPaginated %}
  {% set pageHeaderContent = {
    title: {
      text: entry.title,
      moustache: 'Page ' ~ pagination.currentPage ~ ' of '
        ~ pagination.totalPages
    }
  } %}
{% endif %}

{% block header %}
  {{ include('@page-header', pageHeaderContent) }}

  <div class="constrain">
    {% include '@select' with {
      name: 'caseStudySelect',
      id: 'caseStudySelect',
      label: 'Show',
      options: dropDownItems,
      onchange: 'location = this.value;'
    } %}
  </div>
{% endblock %}

{% block main %}
  {% if (caseStudies|length) > 0 %}
    {% include '_cms-slats/case-studies' %}
  {% endif %}

  {% if pagination.nextUrl or pagination.prevUrl %}
    <footer class="Slat constrain flow--s">
      {% if pagination.nextUrl %}
        <nav>
          {% include '@twi' with {
            icon: 'arrow-right',
            text: 'Next 8 case studies',
            link: pagination.nextUrl
          } %}
        </nav>
      {% endif %}
      {% if pagination.prevUrl %}
        <nav>
          {% include '@twi' with {
            icon: 'arrow-left',
            text: 'Previous 8 case studies',
            link: pagination.prevUrl
          } %}
        </nav>
      {% endif %}
    </footer>
  {% endif %}
{% endblock %}
/* No context defined. */

No notes defined.