{"id":20961773,"url":"https://github.com/heimrichhannot/contao-fieldpalette-bundle","last_synced_at":"2025-06-14T01:40:43.152Z","repository":{"id":41086500,"uuid":"124878307","full_name":"heimrichhannot/contao-fieldpalette-bundle","owner":"heimrichhannot","description":"Adds an MultiColumnWizard like widget with own database table to contao.","archived":false,"fork":false,"pushed_at":"2025-03-14T09:30:31.000Z","size":665,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-03T13:54:02.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/heimrichhannot.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-12T11:23:41.000Z","updated_at":"2025-03-11T14:52:13.000Z","dependencies_parsed_at":"2023-12-13T14:37:21.648Z","dependency_job_id":"ab23d3fe-e241-4e67-b778-1ef800762ff7","html_url":"https://github.com/heimrichhannot/contao-fieldpalette-bundle","commit_stats":{"total_commits":91,"total_committers":6,"mean_commits":"15.166666666666666","dds":"0.21978021978021978","last_synced_commit":"d9c863bcc81a12bbd2db6e4b2148c584bbbdc1ce"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-fieldpalette-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-fieldpalette-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-fieldpalette-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-fieldpalette-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heimrichhannot","download_url":"https://codeload.github.com/heimrichhannot/contao-fieldpalette-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254094846,"owners_count":22013648,"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":[],"created_at":"2024-11-19T02:17:04.020Z","updated_at":"2025-05-14T07:31:02.092Z","avatar_url":"https://github.com/heimrichhannot.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Contao FieldPalette bundle\n\n[![](https://img.shields.io/packagist/v/heimrichhannot/contao-fieldpalette-bundle.svg)](https://packagist.org/packages/heimrichhannot/contao-fieldpalette-bundle)\n[![](https://img.shields.io/packagist/dt/heimrichhannot/contao-fieldpalette-bundle.svg)](https://packagist.org/packages/heimrichhannot/contao-fieldpalette-bundle)\n\n\n\u003e If you're in search of an multi column input field and the storage of values in another table isn't an explicit requirement, we recommend to use [Multi Column Editor Bundle](https://github.com/heimrichhannot/contao-multi-column-editor-bundle) instead, as it has less possible side effects and is more often updated due it's higher usage.\n\nFieldPalette is a contao widget similar to [MultiColumnWizard](https://github.com/menatwork/MultiColumnWizard).\nUnlike MultiColumnWizard, fields are stored flatly into `tl_fieldpalette` table and synced with its parent field.\n\nThe fieldpalette configuration is based on Contao's [Data Container Arrays](https://docs.contao.org/books/api/dca/index.html).\n\n![alt fieldpalette wizard](./docs/img/fieldpalette_wizard.jpg)\n*FieldPalette Wizard - ListView*\n\n![alt fieldpalette edit](./docs/img/fieldpalette_edit.jpg)\n*FieldPalette Wizard - Edit item*\n\n\n## Technical instructions\n\n### Install \n\n```\ncomposer require heimrichhannot/contao-fieldpalette-bundle\n```\n\nYou need to updated the contao database updated. \n\n### Getting started\n\nFieldPalette comes with an custom input type `fieldpalette`. The configuration for this input type is done in the `fieldpalette` index of the field configuration array. You can customize your fieldpalette nearly as an \"normal\" dca configuration. When you finished setting up your fieldpalette input, you need to call the contao database tool to add the new fields to the table.  See following example for a real world use case:\n\n#### Default Setup (`tl_fieldpalette` table)\n\n\nThis example shows the setup of an fieldpalette field within tl_news by using it within an subpalette. That (shortend) example is available within the module [Contao News Leisure Bundle](https://github.com/heimrichhannot/contao-news-leisure-bundle).\n\n```php\n# contao/dca/tl_news.php\n\n$GLOBALS['TL_DCA']['tl_news']['fields']['venues'] = [\n    'inputType' =\u003e 'fieldpalette',\n    'foreignKey' =\u003e 'tl_fieldpalette.id',\n    'relation' =\u003e ['type' =\u003e 'hasMany', 'load' =\u003e 'eager'],\n    'sql' =\u003e \"blob NULL\",\n    'fieldpalette' =\u003e [\n        'config' =\u003e [\n            'hidePublished' =\u003e false\n        ],\n        'list' =\u003e [\n            'label' =\u003e [\n                'fields' =\u003e ['venueName', 'venueStreet', 'venuePostal', 'venueCity'],\n                'format' =\u003e '%s \u003cspan style=\"color:#b3b3b3;padding-left:3px\"\u003e[%s, %s %s]\u003c/span\u003e',\n            ],\n        ],\n        'palettes' =\u003e [\n            'default' =\u003e 'venueName,venueStreet,venuePostal,venueCity',\n        ],\n        'fields' =\u003e [\n            'venueName' =\u003e [\n                'label' =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venueName'],\n                'exclude' =\u003e true,\n                'search' =\u003e true,\n                'inputType' =\u003e 'text',\n                'eval' =\u003e ['maxlength' =\u003e 255, 'tl_class' =\u003e 'long'],\n                'sql' =\u003e \"varchar(255) NOT NULL default ''\",\n            ],\n            'venueStreet' =\u003e [\n                'label' =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venueStreet'],\n                'exclude' =\u003e true,\n                'search' =\u003e true,\n                'inputType' =\u003e 'text',\n                'eval' =\u003e ['maxlength' =\u003e 255, 'tl_class' =\u003e 'w50'],\n                'sql' =\u003e \"varchar(255) NOT NULL default ''\",\n            ],\n            'venuePostal' =\u003e [\n                'label' =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venuePostal'],\n                'exclude' =\u003e true,\n                'search' =\u003e true,\n                'inputType' =\u003e 'text',\n                'eval' =\u003e ['maxlength' =\u003e 32, 'tl_class' =\u003e 'w50'],\n                'sql' =\u003e \"varchar(32) NOT NULL default ''\",\n            ],\n            'venueCity' =\u003e [\n                'label' =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venueCity'],\n                'exclude' =\u003e true,\n                'filter' =\u003e true,\n                'search' =\u003e true,\n                'sorting' =\u003e true,\n                'inputType' =\u003e 'text',\n                'eval' =\u003e ['maxlength' =\u003e 255, 'tl_class' =\u003e 'w50'],\n                'sql' =\u003e \"varchar(255) NOT NULL default ''\",\n            ],\n        ],\n    ],\n];\n```\n\n\n## Developers\n\n### Guides\n\n[DCA reference](docs/developers/dca_reference.md)  \n[Custom table set up](docs/developers/custom_table.md)  \n[Working with fieldpalette records](/docs/developers/fieldpalette_records.md) (copying (parent) records)  \n\n### Working with fieldpalette model\n\nThe `FieldPaletteModel` is not intended to be called directly and all custom methods are non static. We recommend to use the `huh.fieldpalette.manager` service. \n\nExample: \n```php\n/** \n * @var ContainerInterface $container \n */\n\n// Return a model instance (with default table) for usage with model method (like find methods)\n$container-\u003eget('huh.fieldpalette.manager')-\u003egetInstance()-\u003efindByPidAndTableAndField($item-\u003eid, 'tl_item', 'parentItem');\n\n// Return a new model instance\n$container-\u003eget('huh.fieldpalette.manager')-\u003ecreateModel()-\u003efindByPidAndTableAndField($item-\u003eid, 'tl_item', 'parentItem');\n\n// Return a new model instance with custom table\n$container-\u003eget('huh.fieldpalette.manager')-\u003ecreateModelByTable('tl_my_custom_table')-\u003efindByPidAndTableAndField($item-\u003eid, 'tl_item', 'parentItem');\n```\n\nDefault model methods are still callable static. Custom method can also be called by creating a new model instance. \n\n### Widgets\n\nName         | Description\n------------ | -----------\nfieldpalette | The FieldPaletteWizard renders the tl_fieldpalette items and provide crud functionality within its parent record (e.g. tl_news).\n\n### Fields\n\ntl_fieldpalette:\n\nName      | Description\n--------- | -----------\nid        | autoincrement unique identifiere\npid       | id of the parent entry\nptable    | parent table name (e.g. tl_news)\npfield    | parent field name (e.g. tl_news.venues)\nsorting   | the sorting value\npublished | the published state (1 = published) \nstart     | timestamp from where the element is published \nstop      | timestamp until the element is published\n\n### Form Callbacks\n\ntl_fieldpalette:\n\nType              | Description\n----------------- | -----------\noncreate_callback | Get fieldpalette key from request, check if the parent table is active within Fieldpalette Registry and set the pfield to tl_fieldpalette item. \nonsubmit_callback | Update/Sync parent fieldpalette item value (for example tl_news.venues) when tl_fieldpalette entries were updated.\noncut_callback    | Update/Sync parent fieldpalette item value (for example tl_news.venues) when tl_fieldpalette entries were sorted.\nondelete_callback | Update/Sync parent fieldpalette item value (for example tl_news.venues) when tl_fieldpalette entries were deleted.\n\n\n### Hooks\n\nName               | Arguments                     | Description\n-----------------  | ----------------------------- | -----------\nloadDataContainer  | $strTable                     | Register fields from parent datacontainer (like tl_news) to tl_fieldpalette and disable fieldpalette support from back end modules where no fieldpalette fields exists (see: initializeSystem Hook). \ninitializeSystem   | -                             | Enable tl_fieldpalette table within all back end modules.\t\nexecutePostActions | $strAction, DataContainer $dc | Add refreshFieldPaletteField ajax action that return the updated FieldPaletteWizard content.\n\n## Restrictions\n\n* only supports DC_Table DataContainers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fcontao-fieldpalette-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheimrichhannot%2Fcontao-fieldpalette-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fcontao-fieldpalette-bundle/lists"}