We have glossary entries in Sulu and would like to iterate over these items via pagination.

We use smartContent with Pagination:

This works for pagination like "/glossary?p=2"

We have like to extend this to be able to use the pagination with additional query parameter "letter" like
"/glossary?p=3&letter=B"

We implemented it like described in the docs
https://docs.sulu.io/en/2.0/cookbook/custom-page-data-provider.html

In the moment we don't know how to get query parameter letter from the request
Code from our QueryBuilder

private ?string $letter = null; public function init(array $options) { parent::init($options); $this->letter = $options['letter'] ?? null; } protected function buildWhere($webspaceKey, $locale) { $sql2Where = explode(' AND ', parent::buildWhere($webspaceKey, $locale)); // letter parameter is alsways empty $sql2Where[] = "page.[i18n:{$locale}-title] LIKE '{$this->letter}%'"; //hard coded is working //$sql2Where[] = "page.[i18n:{$locale}-title] LIKE 'B%'"; return implode(' AND ', $sql2Where); }

How can we pass the query parameter letter to the QueryBuilder?

Technical:

Sulu 2.6.5

php 8.3

Competo's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.