{"id":19692186,"url":"https://github.com/getgrav/grav-plugin-data-manager","last_synced_at":"2025-04-29T09:31:23.652Z","repository":{"id":43260985,"uuid":"42188686","full_name":"getgrav/grav-plugin-data-manager","owner":"getgrav","description":"Grav Data Manager Plugin","archived":false,"fork":false,"pushed_at":"2022-03-11T10:05:15.000Z","size":97,"stargazers_count":30,"open_issues_count":10,"forks_count":18,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2025-04-19T07:42:52.796Z","etag":null,"topics":["data","data-visualization","grav","grav-plugin"],"latest_commit_sha":null,"homepage":"http://getgrav.org","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getgrav.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-09T15:53:03.000Z","updated_at":"2023-07-26T17:17:24.000Z","dependencies_parsed_at":"2022-08-29T18:52:17.585Z","dependency_job_id":null,"html_url":"https://github.com/getgrav/grav-plugin-data-manager","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getgrav%2Fgrav-plugin-data-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getgrav%2Fgrav-plugin-data-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getgrav%2Fgrav-plugin-data-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getgrav%2Fgrav-plugin-data-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getgrav","download_url":"https://codeload.github.com/getgrav/grav-plugin-data-manager/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251159643,"owners_count":21545190,"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":["data","data-visualization","grav","grav-plugin"],"created_at":"2024-11-11T19:12:32.286Z","updated_at":"2025-04-29T09:31:23.619Z","avatar_url":"https://github.com/getgrav.png","language":"PHP","readme":"# Grav Data Manager Plugin\n\nThe **Data Manager Plugin** for [Grav](http://github.com/getgrav/grav) adds the ability to visualize data. This is particularly useful for the **admin** and **form** plugins.\nAdditional plugins may store data content, and the Data plugin - properly configured - is able to show their data too.\n\n| IMPORTANT!!! This plugin is currently in development as is to be considered a **beta release**.  As such, use this in a production environment **at your own risk!**. More features will be added in the future.\n\n# Installation\n\nThe Data plugin is easy to install with GPM.\n\n```\n$ bin/gpm install data-manager\n```\n\nOr clone from GitHub and put in the `user/plugins/data-manager` folder.\n\n# Configuration\n\nYou don't need any configuration to start using the plugin.\nKnowing how to configure it, as illustrated later, will allow you to take advantage of a few handy customization options.\n\nRemember: copy the `user/plugins/data-manager/data-manager.yaml` into `user/config/plugins/data-manager.yaml` and make your modifications in your user folder.\n\n# Usage\n\nOnce installed the Data plugin shows a `Data Manager` item in the admin menu. Click that, and the Data plugin will show you the available data types found in the user/data folder.\n\nClicking a data type will show the list of items. For example you might have a contact form setup in your site, using the Form plugin. A `Contact` type should show up, depending on how you called that form data items (data types names are taken from the user/data/ folder names, unless customized - see below).\n\nFor example you might have a `form.md` contact form with:\n\n```yaml\n---\ntitle: A page with a form\nform:\n    name: contactform\n    fields:\n        - name: name\n          label: Name\n          placeholder: Enter your name\n          autofocus: on\n          autocomplete: on\n          type: text\n          validate:\n            required: true\n\n        - name: email\n          label: Email\n          placeholder: Enter your email address\n          type: text\n          validate:\n            rule: email\n            required: true\n\n    buttons:\n        - type: submit\n          value: Submit\n        - type: reset\n          value: Reset\n\n    process:\n        - save:\n            fileprefix: contact-\n            dateformat: Ymd-His-u\n            extension: yaml\n            body: \"{% include 'forms/data.txt.twig' %}\"\n        - message: Thank you for your feedback!\n---\n\n# Nice contact form\n```\n\nIn this case, you have a name and an email field. If you enable the plugin and go in the admin side, you'll see under\nthe Data menu the Contactform type.\n\nClick that, and all the contact information entered is browsable, listed by filename, and you can click an item to show\nits details.\n\n# Customization\n\nAll the things listed above come out of the box, without you needing to do anything special.\nNow, let's make the list more user friendly.\n\n## List customization\n\nBy default the list shows items listed by the filename.\nYou might want to show some more information in the list, so you can for example have 2 columns, name and email.\n\nOpen the `user/config/plugins/data-manager.yaml` and add the structure of the data files, and the files extension.\nThe name of the type is the one of the data/ subfolder (in the case of the Form plugin, set by form.name)\n\n```yaml\ntypes:\n  contactform:\n    list:\n      columns:\n        -\n            field: name\n            label: Name\n        -\n            field: email\n            label: Email\n```\n\n### Columns with nested content\n\nTo show in the items list nested content, use an array:\n\n```yaml\nlist:\n  columns:\n    -\n      field: ['address', 'email']\n      label: Email\n```\n\nWill render the address.email value.\n\n## Single item customization\n\n```yaml\nenabled: true\n\ntypes:\n  contactform:\n    item:\n      fields:\n        name:\n          name: Token\n        email:\n          name: Email\n```\n\nWill render those fields listed, and **just** those fields.\nBy default, the single item view lists all the fields found in the file.\n\n## File extension customization\n\nUsually data is saved in .yaml files. You can change that per-type by setting:\n\n```yaml\ntypes:\n  contactform:\n    file_extension: '.txt'\n```\n\n## Customize the type name\n\nBy default the Types list shows the folder name. You can add\n\n```yaml\ntypes:\n  contactform:\n    name: Contact Form\n```\n\nto provide a better name.\n\n# Override items list and item detail templates\n\nYou can override items list and item details Twig templates using a plugin.\n\nBy doing this, you can build plugins that\n\n1. store data in the data/ folder\n2. have **complete control over the data rendering in the admin-side**\n\nYou can register the templates in the admin-side and put them in your plugin templates folder under `partials/data-manager/[typename]/item.html.twig` and/or `partials/data-manager/[typename]/items.html.twig`.\n\n# Programmatically exclude a data folder from the Data Manager\n\nSay you are developing a plugin that stores in the data/ folder, and you want to create your own admin interface to show the data. No problem! You can instruct the Data Manager plugin to ignore your data type (data/ subfolder).\n\nJust listen for the `onDataTypeExcludeFromDataManagerPluginHook` event\n\n```php\n$this-\u003eenable([\n    'onDataTypeExcludeFromDataManagerPluginHook' =\u003e ['onDataTypeExcludeFromDataManagerPluginHook', 0],\n]);\n```\n\nand add the data type you want to exclude by adding it to a property of the Admin Plugin:\n\n```php\n public function onDataTypeExcludeFromDataManagerPluginHook()\n {\n     $this-\u003egrav['admin']-\u003edataTypesExcludedFromDataManagerPlugin[] = 'comments';\n }\n ```\n\n# Future improvements\n\nThis is a first revision of the plugin.\n\nIdeas for the near future:\n\n- Allow plugins to define yaml for data,\n- Better integration with the Form plugin (auto-determine types definition)\n- Add a \"process\" field in the columns/fields to filter raw data (e.g. dates or booleans)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetgrav%2Fgrav-plugin-data-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetgrav%2Fgrav-plugin-data-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetgrav%2Fgrav-plugin-data-manager/lists"}