{"id":26234897,"url":"https://github.com/flowpack/flowpack.listable","last_synced_at":"2025-04-04T14:06:16.433Z","repository":{"id":2091481,"uuid":"45689830","full_name":"Flowpack/Flowpack.Listable","owner":"Flowpack","description":"Neos package that helps you to render lists of things","archived":false,"fork":false,"pushed_at":"2025-04-03T13:10:44.000Z","size":145,"stargazers_count":35,"open_issues_count":6,"forks_count":17,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-04T13:58:48.086Z","etag":null,"topics":["neoscms","pagination"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/flowpack/listable","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Flowpack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-06T15:26:44.000Z","updated_at":"2025-04-03T13:07:03.000Z","dependencies_parsed_at":"2024-03-15T12:31:13.922Z","dependency_job_id":"07c7fc2b-f426-431e-841c-767ba8ecbdcc","html_url":"https://github.com/Flowpack/Flowpack.Listable","commit_stats":{"total_commits":157,"total_committers":17,"mean_commits":9.235294117647058,"dds":"0.19108280254777066","last_synced_commit":"0dfe9e278b7c52d06ec25ca179356106737caa89"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowpack%2FFlowpack.Listable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowpack%2FFlowpack.Listable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowpack%2FFlowpack.Listable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowpack%2FFlowpack.Listable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flowpack","download_url":"https://codeload.github.com/Flowpack/Flowpack.Listable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190250,"owners_count":20898702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neoscms","pagination"],"created_at":"2025-03-13T02:29:53.191Z","updated_at":"2025-04-04T14:06:16.425Z","avatar_url":"https://github.com/Flowpack.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Listable\n\nThis Neos package solves one problem: help you list any nodes in Fusion.\nThe idea is very simple: you often need to display list of things (e.g. news, articles etc), and the concern of listing items should better be separated from the concern of rendering items. This package provides a solid foundation for listing, while allowing you to take care of rendering stuff on your own.\n\n# TL;DR\n\n1. Install the package with composer: `composer require flowpack/listable` [Here it is on packagist](https://packagist.org/packages/flowpack/listable).\n2. If you want a paginated list, use `Flowpack.Listable:PaginatedCollection`.\n3. If you just want a simple list, use `Flowpack.Listable:Collection` (or just `Neos.Fusion:Collection`!).\n4. If you need a list with a header and an archive link, wrap you list into `Flowpack.Listable:List`\n5. For each of your nodetypes create a new Fusion object of type NodeTypeName + '.Short', or manually define a rendering object.\n6. Rely on public API keys when overriding settings.\n\n# Fusion objects\n\nKeys documented here are considered public API and would be treated with semantic versioning in mind. Extend all other properties at your own risk.\n\n## Flowpack.Listable:Collection\n\nThis object is just a simple convienince wrapper around `Neos.Fusion:Collection`, use it if you want to save a few keystrokes.\nIt wraps the list with UL and LI tags with a provided name and also set `Flowpack.Listable:ContentCaseShort` as a default for itemRenderer.\n\nConfiguration options:\n\n| Setting | Description | Defaults |\n|---------|-------------|----------|\n| collection | An instance of `ElasticSearchQueryBuilder`, `FlowQuery` object or an `array` of nodes | 'to-be-set' |\n| listClass | Classname of UL tag | '' |\n| itemClass | Classname of LI tag wrapping each item | '' |\n| itemRenderer | Object used for rendering child items. Within it you get two context vars set: `node` and `iterator` | 'Flowpack.Listable:ContentCaseShort' |\n| itemName | Name of the the node context variable | 'node' |\n| iterationName | Name of the the iterator context variable | 'iteration' |\n\nExample:\n\n```\nprototype(My.Custom:Object) \u003c prototype(Flowpack.Listable:Collection) {\n  collection = ${q(site).find('[instanceof Something.Custom:Here]').sort('date', 'DESC').slice(0, 6).get()}\n  listClass = 'MyList'\n  itemClass = 'MyList-item'\n}\n```\n\nIt would use the object `Something.Custom:Here.Short` for rendering each item.\n\nMake sure to correctly configure the cache.\n\n## Flowpack.Listable:PaginatedCollection\n\nThis object allows you to paginate either **ElasticSearch** results, FlowQuery result objects or pure Node arrays.\n\nConfiguration options:\n\n| Setting | Description | Defaults |\n|---------|-------------|----------|\n| collection | An instance of `ElasticSearchQueryBuilder`, `FlowQuery` object or an `array` of nodes | 'to-be-set' |\n| itemsPerPage | Number of items per page when using pagination | 24 |\n| maximumNumberOfLinks | Number of page links in pagination | 15 |\n| listRenderer | Object used for rendering the list. | 'Flowpack.Listable:Collection' |\n| showPreviousNextLinks| Boolean value used to decide whether the previous and next links should be added| false |\n\nWhen used with ElasticSearch, build the query, but don't execute it, the object will do it for you:\n\n```\nprototype(My.Custom:Object) \u003c prototype(Flowpack.Listable:PaginatedCollection) {\n  collection = ${Search.query(site).nodeType('Something.Custom:Here').sortDesc('date')}\n  itemsPerPage = 12\n  prototype(Flowpack.Listable:Collection) {\n    listClass = 'MyPaginatedList'\n    itemClass = 'MyPaginatedList-item'\n  }\n}\n```\n\nIf you have additional URL parameters (e.g for a date filter) you have to register the argument and change the cache entryDiscriminator in order work accordingly.\nHINT: Do not forget to register a corresponding route for your custom argument.\n\n```\nprototype(My.Custom:Object) \u003c prototype(Flowpack.Listable:PaginatedCollection) {\n  ...\n\n  prototype(Flowpack.Listable:PaginationParameters) {\n    date = ${request.arguments.data}\n  }\n\n  @cache {\n    entryDiscriminator = ${request.arguments.currentPage + request.arguments.date}\n  }\n\n}\n```\n\nThis object is configured by default to `dynamic` cache mode for pagination to work. All you have to do is add correct `entryTags` and you are all set.\n\n## Flowpack.Listable:List\n\nThere's often a need to render a list with a header and an archive link.\nThis object takes your list and wraps it with just that.\n\nConfiguration options:\n\n| Setting | Description | Defaults |\n|---------|-------------|----------|\n| wrapClass | Class of the div that wraps the whole object | '' |\n| listTitle | Title of the list | '' |\n| listTitleClass | Class of the list title | '' |\n| archiveLink | Nodepath for the archive link | '' |\n| archiveLinkTitle | Title of the archive link | '' |\n| archiveLinkClass | Classname of the archive link | '' |\n| archiveLinkAdditionalParams | AdditionalParams of the archive link, e.g. `@context.archiveLinkAdditionalParams = ${{archive: 1}}` | {} |\n| list | A list that this object should wrap | `value` |\n\nExample:\n\n```\nprototype(My.Custom:Object) \u003c prototype(Flowpack.Listable:PaginatedCollection) {\n  @process.list = Flowpack.Listable:List {\n    listTitle = 'My List'\n    archiveLink = '~/page-path-or-identifier'\n    archiveLinkTitle = 'See all news'\n  }\n  collection = ${q(site).find('[instanceof Something.Custom:Here]').sort('date', 'DESC').slice(0, 6).get()}\n}\n```\n\n## Flowpack.Listable:Pagination\n\nYou can also use pagination standalone from the `PaginatedCollection`.\n\nConfiguration options:\n\n| Setting | Description | Defaults |\n|---------|-------------|----------|\n| totalCount | A total count of items | 'to-be-set' |\n| itemsPerPage | Number of items per page | 24 |\n| maximumNumberOfLinks | A maximum number of links | 15 |\n| class | A class around pagination | 'Pagination' |\n| itemClass | A total count of items | 'Pagination-item' |\n| currentItemClass | A class for a current item | 'isCurrent' |\n| currentPage | Current page, starting with 1 | `${request.arguments.currentPage || 1}` |\n| showPreviousNextLinks| Boolean value used to decide whether the previous and next links should be added| false |\n\n# FlowQuery Helpers you can use\n\n## filterByDate\n\nFilter nodes by properties of type date.\n\n## filterByReference\n\nFilter nodes by properties of type reference or references.\n\n## sortRecursiveByIndex\n\nSort nodes by their position in the node tree. Please use with care, as this can become a very expensive operation, if you operate on bigger subtrees.\n\nExample:\n\n    ${q(node).children(\"main\").sortRecursiveByIndex('DESC').get()}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowpack%2Fflowpack.listable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflowpack%2Fflowpack.listable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowpack%2Fflowpack.listable/lists"}