{"id":14968640,"url":"https://github.com/wieni/wmentity_overview","last_synced_at":"2025-08-23T16:11:07.746Z","repository":{"id":56543071,"uuid":"237186428","full_name":"wieni/wmentity_overview","owner":"wieni","description":"Improved EntityListBuilders with support for paging, table sorting, table dragging, filtering, database queries and more.","archived":false,"fork":false,"pushed_at":"2025-08-11T21:19:53.000Z","size":89,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-11T23:28:14.196Z","etag":null,"topics":["drupal-module","drupal8","drupal8-module","entity-api"],"latest_commit_sha":null,"homepage":null,"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/wieni.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2020-01-30T10:09:30.000Z","updated_at":"2025-08-11T21:19:30.000Z","dependencies_parsed_at":"2024-03-18T10:31:14.959Z","dependency_job_id":"3ae517af-d517-4724-9da2-35be1773ddc7","html_url":"https://github.com/wieni/wmentity_overview","commit_stats":{"total_commits":53,"total_committers":2,"mean_commits":26.5,"dds":"0.018867924528301883","last_synced_commit":"fb9eb265aab4c5e02fb641c5047aeb649e815958"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/wieni/wmentity_overview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wieni%2Fwmentity_overview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wieni%2Fwmentity_overview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wieni%2Fwmentity_overview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wieni%2Fwmentity_overview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wieni","download_url":"https://codeload.github.com/wieni/wmentity_overview/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wieni%2Fwmentity_overview/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271755444,"owners_count":24815408,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["drupal-module","drupal8","drupal8-module","entity-api"],"created_at":"2024-09-24T13:40:20.436Z","updated_at":"2025-08-23T16:11:07.705Z","avatar_url":"https://github.com/wieni.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Entity Overview\n======================\n\n[![Latest Stable Version](https://poser.pugx.org/wieni/wmentity_overview/v/stable)](https://packagist.org/packages/wieni/wmentity_overview)\n[![Total Downloads](https://poser.pugx.org/wieni/wmentity_overview/downloads)](https://packagist.org/packages/wieni/wmentity_overview)\n[![License](https://poser.pugx.org/wieni/wmentity_overview/license)](https://packagist.org/packages/wieni/wmentity_overview)\n\n\u003e Improved EntityListBuilders with support for paging, table sorting,\n\u003e table dragging, filtering, bulk actions, database queries and more.\n\n## Why?\nAt Wieni, we're not a big fan of the\n[Views](https://www.drupal.org/docs/8/core/modules/views) module and for\na couple of reasons:\n- we're programmers, we don't like to create functionality by clicking\n  through the Drupal interface and especially not the bloated Views\n  interface\n- we prefer to write our own database or entity queries, it gives us\n  more flexibility when filtering and including non-entity field data\n  and it makes it easier to optimize queries\n\nThat's why a couple of years ago we decided to disable the module\naltogether and we ended up with the\n[EntityListBuilder](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityListBuilder.php/class/EntityListBuilder/8.2.x) based\nlistings.\n\nThose proved to be lacking in functionality and user friendliness soon\nenough, which is how we ended up creating this module: the perfect\nmiddle ground between Views and EntityListBuilder. It offers all\nfeatures of the latter, plus the following:\n\n- **Exposed filtering** with a custom form\n- **Behind-the-scenes filtering** using custom database queries\n- **Table sorting**, configurable on a per-column basis\n- **Bulk actions** using core [Action plugins](https://www.drupal.org/node/2020549)\n- **Override built-in entity listings** with a custom one, on an entity\n  type or bundle level\n- **Override any route** with a custom entity listing\n\n## Installation\n\nThis package requires PHP 7.1 and Drupal 8 or higher. It can be\ninstalled using Composer:\n\n```bash\n composer require wieni/wmentity_overview\n```\n\n## How does it work?\n### Create an overview\nOverviews are Drupal plugins with the\n[`@OverviewBuilder`](src/Annotation/OverviewBuilder.php) annotation.\nEvery annotation needs at least the `entity_type` and `id` parameters to\nfunction.\n\nThere are three base classes you can choose from:\n- [`OverviewBuilderBase`](src/OverviewBuilder/OverviewBuilderBase.php): the most basic entity overview with support\n  for database queries, paging and table sort\n- [`FilterableOverviewBuilderBase`](src/OverviewBuilder/FilterableOverviewBuilderBase.php):\n  an entity overview combining the base functionality with an exposed\n  filter form\n- [`DraggableOverviewBuilderBase`](src/OverviewBuilder/DraggableOverviewBuilderBase.php):\n  an entity overview with a draggable, re-orderable table, but without\n  support for paging or filtering\n\n#### Example\n```php\n\u003c?php\n\nnamespace Drupal\\yourmodule\\Plugin\\EntityOverview;\n\n/**\n * @OverviewBuilder(\n *     entity_type = \"node\",\n * )\n */\nclass NodeOverview extends FilterableOverviewBuilderBase\n{\n}\n```\n\n### Override en existing entity listing\nYou can override the default entity listing with a custom overview by\nadding the `override` parameter to the annotation. In case the entity\ntype is not recognised by this module, you can add the `route_name` and\npass the route name of the entity listing instead.\n\nIt is also possible to override the entity listing only when a certain\ncombination of filters is active. This way, you could for example add\nextra filters or table columns when your overview is filtered by a\ncertain bundle.\n\n#### Examples\n```php\n\u003c?php\n\nnamespace Drupal\\yourmodule\\Plugin\\EntityOverview;\n\n/**\n * @OverviewBuilder(\n *     id = \"node\",\n *     entity_type = \"node\",\n *     override = true,\n * )\n */\nclass NodeOverview extends FilterableOverviewBuilderBase\n{\n}\n```\n\n```php\n\u003c?php\n\nnamespace Drupal\\yourmodule\\Plugin\\EntityOverview;\n\n/**\n * @OverviewBuilder(\n *     id = \"redirect\",\n *     entity_type = \"redirect\",\n *     route_name = \"redirect.list\",\n * )\n */\nclass RedirectOverview extends FilterableOverviewBuilderBase\n{\n}\n```\n\n```php\n\u003c?php\n\nnamespace Drupal\\yourmodule\\Plugin\\EntityOverview;\n\n/**\n * @OverviewBuilder(\n *     id = \"node.article\",\n *     entity_type = \"node\",\n *     override = true,\n *     filters = {\n *         \"type\" = \"article\",\n *     },\n * )\n */\nclass ArticleOverview extends NodeOverview\n{\n}\n```\n\n### Render an overview\nWhen you create an overview without overriding an existing route, you\nwill have to render it somewhere manually.\n\nCreating an instance of an entity overview is done the same way as other\nDrupal plugins, by using the `createInstance` method of\n[`OverviewBuilderManager`](src/OverviewBuilder/OverviewBuilderManager.php).\n\nAnother option is adding `_entity_overview` to the `defaults` section of\nyour route definition, with as value the plugin id.\n\n#### Example\n```yaml\nyourmodule.content_overview.article:\n    path: '/admin/content/article'\n    defaults:\n        _entity_overview: 'node.article'\n        _title: 'Articles'\n    requirements:\n        _permission: 'administer nodes'\n    options:\n        _admin_route: TRUE\n```\n\n### Filter storages\nEntity overviews with exposed filter forms need a place to (temporarily)\nstore their filter values. That's where filter storages come to play:\nan abstraction in the way these values are stored.\n\nBy default, two storage methods are included: `query`, which stores\nvalues as query parameters in the URL and `session`, which stores values\nin the session storage.\n\nCustom storage methods can be added by creating a Drupal plugin with the\n[`@FilterStorage`](src/Annotation/FilterStorage.php) annotation and an\n`id` parameter, implementing\n[`FilterStorageInterface`](src/FilterStorage/FilterStorageInterface.php)\nand optionally extending\n[`FilterStorageBase`](src/FilterStorage/FilterStorageBase.php).\n\nThe default storage method is `query`, but this can be changed by adding\na `filter_storage` parameter to `@OverviewBuilder` annotations.\n\n### Add bulk actions\nBulk actions can be added to your overview by implementing \n[`BulkActionOverviewBuilderInterface`](src/OverviewBuilder/BulkActionOverviewBuilderInterface.php)\nand the `getBulkActionPlugins` method. This method can return two kinds of arrays:\n\n- an associative array with the plugin IDs as keys and the labels as values\n- a flat array with plugin ID's\n\nIn the last case the default plugin labels will be used. \n\nIt is possible to attach a configuration form to your action plugin by implementing \n[`PluginFormInterface`](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Plugin%21PluginFormInterface.php/interface/PluginFormInterface).\nIn case you need access to the entities in your form validate and/or submit handlers, you can implement \n[`ActionPluginFormInterface`](src/Plugin/Action/ActionPluginFormInterface.php) instead. Note that in contrary to \n`PluginFormInterface` this is a custom interface, only supported by this module.\n\n### Hooks and events\n#### `hook_entity_overview_alter`\nThis hook is only called when using overrides or when using the\n`_entity_overview` default in routes. An event equivalent to the hook is\nalso provided:\n[`WmEntityOverviewEvents::ENTITY_OVERVIEW_ALTER`](src/WmEntityOverviewEvents.php)\n\n##### Examples\n```php\n\u003c?php\n\nuse Drupal\\wmentity_overview\\Annotation\\OverviewBuilder;\n\nfunction yourmodule_entity_overview_alter(OverviewBuilder $definition, array \u0026$overview)\n{\n    if (!empty($overview['form'])) {\n        $overview['form']['#attributes']['class'][] = 'custom-entity-overview__form';\n    }\n\n    $overview['table']['#attributes']['class'][] = 'custom-entity-overview__table';\n}\n```\n\n```php\n\u003c?php\n\nnamespace Drupal\\yourmodule\\EventSubscriber;\n\nuse Drupal\\wmentity_overview\\Event\\EntityOverviewAlterEvent;\nuse Drupal\\wmentity_overview\\WmEntityOverviewEvents;\nuse Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\n\nclass EntityOverviewSubscriber implements EventSubscriberInterface\n{\n    public static function getSubscribedEvents()\n    {\n        $events[WmEntityOverviewEvents::ENTITY_OVERVIEW_ALTER][] = ['onAlter'];\n\n        return $events;\n    }\n\n    public function onAlter(EntityOverviewAlterEvent $event): void\n    {\n        $overview = \u0026$event-\u003egetOverview();\n\n        if (!empty($overview['form'])) {\n            $overview['form']['#attributes']['class'][] = 'custom-entity-overview__form';\n        }\n    \n        $overview['table']['#attributes']['class'][] = 'custom-entity-overview__table';\n    }\n}\n```\n\n#### `hook_entity_overview_alternatives_alter`\nThis hook is only called in the\n[`OverviewBuilderManager::getAlternatives`](src/OverviewBuilder/OverviewBuilderManager.php)\nmethod. An event equivalent to the hook is also provided:\n[`WmEntityOverviewEvents::ENTITY_OVERVIEW_ALTERNATIVES_ALTER`](src/WmEntityOverviewEvents.php)\n\n#### Example\n```php\n\u003c?php\n\nnamespace Drupal\\yourmodule\\EventSubscriber;\n\nuse Drupal\\Core\\Routing\\RouteMatchInterface;\nuse Drupal\\wmentity_overview\\Event\\EntityOverviewAlternativesAlterEvent;\nuse Drupal\\wmentity_overview\\OverviewBuilder\\OverviewBuilderManager;\nuse Drupal\\wmentity_overview\\WmEntityOverviewEvents;\nuse Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\n\nclass EntityOverviewAlternativesSubscriber implements EventSubscriberInterface\n{\n    /** @var OverviewBuilderManager */\n    protected $overviewBuilders;\n    /** @var RouteMatchInterface */\n    protected $routeMatch;\n\n    public function __construct(\n        OverviewBuilderManager $overviewBuilders,\n        RouteMatchInterface $routeMatch\n    ) {\n        $this-\u003eoverviewBuilders = $overviewBuilders;\n        $this-\u003erouteMatch = $routeMatch;\n    }\n\n    public static function getSubscribedEvents()\n    {\n        $events[WmEntityOverviewEvents::ENTITY_OVERVIEW_ALTERNATIVES_ALTER][] = ['onTaxonomyAlternativesAlter'];\n\n        return $events;\n    }\n\n    /**\n     * Since taxonomy has a per-bundle overview, we get the bundle from\n     * the route parameters and use it to add more possible alternatives.\n     */\n    public function onTaxonomyAlternativesAlter(EntityOverviewAlternativesAlterEvent $event): void\n    {\n        if (!$vocabulary = $this-\u003erouteMatch-\u003egetParameter('taxonomy_vocabulary')) {\n            return;\n        }\n\n        if ($event-\u003egetDefinition()-\u003egetEntityTypeId() !== 'taxonomy_term') {\n            return;\n        }\n\n        $filters = ['vid' =\u003e $vocabulary-\u003eid()];\n        $alternatives = array_merge(\n            $event-\u003egetAlternatives(),\n            $this-\u003eoverviewBuilders-\u003egetAlternativesByFilters($event-\u003egetDefinition(), $filters)\n        );\n\n        $event-\u003esetAlternatives($alternatives);\n    }\n}\n```\n## Changelog\nAll notable changes to this project will be documented in the\n[CHANGELOG](CHANGELOG.md) file.\n\n## Security\nIf you discover any security-related issues, please email\n[security@wieni.be](mailto:security@wieni.be) instead of using the issue\ntracker.\n\n## License\nDistributed under the MIT License. See the [LICENSE](LICENSE.md) file\nfor more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwieni%2Fwmentity_overview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwieni%2Fwmentity_overview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwieni%2Fwmentity_overview/lists"}