{"id":20961763,"url":"https://github.com/heimrichhannot/contao-fieldpalette","last_synced_at":"2026-03-07T00:02:04.615Z","repository":{"id":62515479,"uuid":"50343141","full_name":"heimrichhannot/contao-fieldpalette","owner":"heimrichhannot","description":"FieldPalette is a contao widget like [MultiColumnWizard] (https://github.com/menatwork/MultiColumnWizard) with its own database table.","archived":false,"fork":false,"pushed_at":"2018-07-12T07:58:18.000Z","size":1007,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-08T22:28:24.267Z","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}},"created_at":"2016-01-25T10:23:54.000Z","updated_at":"2018-11-04T09:48:06.000Z","dependencies_parsed_at":"2022-11-02T13:03:36.886Z","dependency_job_id":null,"html_url":"https://github.com/heimrichhannot/contao-fieldpalette","commit_stats":null,"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"purl":"pkg:github/heimrichhannot/contao-fieldpalette","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-fieldpalette","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-fieldpalette/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-fieldpalette/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-fieldpalette/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heimrichhannot","download_url":"https://codeload.github.com/heimrichhannot/contao-fieldpalette/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-fieldpalette/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-11-19T02:16:45.349Z","updated_at":"2026-03-07T00:02:04.592Z","avatar_url":"https://github.com/heimrichhannot.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FieldPalette\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## Technical instructions\n\n### Default Setup (`tl_fieldpalette` table)\n\nThis example shows the setup of an fieldpalette field within tl_news by using it within an subpalette. That example is available within the module [heimrichhannot/contao-plus] (https://packagist.org/packages/heimrichhannot/contao-news_plus).\n\n```\n#/system/modules/[MyModule]/dca/tl_news.php\n\n$dc = \u0026$GLOBALS['TL_DCA']['tl_news'];\n\n/**\n * Selectors\n */\n$dc['palettes']['__selector__'][] = 'addVenues';\n\n/**\n * Subpalettes\n */\n$dc['subpalettes']['addVenues'] = 'venues';\n\n/**\n * Fields\n */\n$arrFields = array\n(\n\t// venue\n\t'addVenues'           =\u003e array\n\t(\n\t\t'label'     =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['addVenues'],\n\t\t'exclude'   =\u003e true,\n\t\t'inputType' =\u003e 'checkbox',\n\t\t'eval'      =\u003e array('submitOnChange' =\u003e true),\n\t\t'sql'       =\u003e \"char(1) NOT NULL default ''\",\n\t),\n\t'venues'              =\u003e array\n\t(\n\t\t'label'        =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venues'],\n\t\t'inputType'    =\u003e 'fieldpalette',\n\t\t'foreignKey'   =\u003e 'tl_fieldpalette.id',\n\t\t'relation'     =\u003e array('type' =\u003e 'hasMany', 'load' =\u003e 'eager'),\n\t\t'sql'          =\u003e \"blob NULL\",\n\t\t'fieldpalette' =\u003e array\n\t\t(\n\t\t\t'config' =\u003e array(\n\t\t\t\t'hidePublished' =\u003e false\n\t\t\t),\n\t\t\t'list'     =\u003e array\n\t\t\t(\n\t\t\t\t'label' =\u003e array\n\t\t\t\t(\n\t\t\t\t\t'fields' =\u003e array('venueName', 'venueStreet', 'venuePostal', 'venueCity'),\n\t\t\t\t\t'format' =\u003e '%s \u003cspan style=\"color:#b3b3b3;padding-left:3px\"\u003e[%s, %s %s]\u003c/span\u003e',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'palettes' =\u003e array\n\t\t\t(\n\t\t\t\t'default' =\u003e 'venueName,venueStreet,venuePostal,venueCity,venueCountry,venueSingleCoords,venuePhone,venueFax,venueEmail,venueWebsite,venueText',\n\t\t\t),\n\t\t\t'fields'   =\u003e array\n\t\t\t(\n\t\t\t\t'venueName'         =\u003e array\n\t\t\t\t(\n\t\t\t\t\t'label'     =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venueName'],\n\t\t\t\t\t'exclude'   =\u003e true,\n\t\t\t\t\t'search'    =\u003e true,\n\t\t\t\t\t'inputType' =\u003e 'text',\n\t\t\t\t\t'eval'      =\u003e array('maxlength' =\u003e 255, 'tl_class' =\u003e 'long'),\n\t\t\t\t\t'sql'       =\u003e \"varchar(255) NOT NULL default ''\",\n\t\t\t\t),\n\t\t\t\t'venueStreet'       =\u003e array\n\t\t\t\t(\n\t\t\t\t\t'label'     =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venueStreet'],\n\t\t\t\t\t'exclude'   =\u003e true,\n\t\t\t\t\t'search'    =\u003e true,\n\t\t\t\t\t'inputType' =\u003e 'text',\n\t\t\t\t\t'eval'      =\u003e array('maxlength' =\u003e 255, 'tl_class' =\u003e 'w50'),\n\t\t\t\t\t'sql'       =\u003e \"varchar(255) NOT NULL default ''\",\n\t\t\t\t),\n\t\t\t\t'venuePostal'       =\u003e array\n\t\t\t\t(\n\t\t\t\t\t'label'     =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venuePostal'],\n\t\t\t\t\t'exclude'   =\u003e true,\n\t\t\t\t\t'search'    =\u003e true,\n\t\t\t\t\t'inputType' =\u003e 'text',\n\t\t\t\t\t'eval'      =\u003e array('maxlength' =\u003e 32, 'tl_class' =\u003e 'w50'),\n\t\t\t\t\t'sql'       =\u003e \"varchar(32) NOT NULL default ''\",\n\t\t\t\t),\n\t\t\t\t'venueCity'         =\u003e array\n\t\t\t\t(\n\t\t\t\t\t'label'     =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venueCity'],\n\t\t\t\t\t'exclude'   =\u003e true,\n\t\t\t\t\t'filter'    =\u003e true,\n\t\t\t\t\t'search'    =\u003e true,\n\t\t\t\t\t'sorting'   =\u003e true,\n\t\t\t\t\t'inputType' =\u003e 'text',\n\t\t\t\t\t'eval'      =\u003e array('maxlength' =\u003e 255, 'tl_class' =\u003e 'w50'),\n\t\t\t\t\t'sql'       =\u003e \"varchar(255) NOT NULL default ''\",\n\t\t\t\t),\n\t\t\t\t'venueCountry'      =\u003e array\n\t\t\t\t(\n\t\t\t\t\t'label'     =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venueCountry'],\n\t\t\t\t\t'exclude'   =\u003e true,\n\t\t\t\t\t'filter'    =\u003e true,\n\t\t\t\t\t'sorting'   =\u003e true,\n\t\t\t\t\t'inputType' =\u003e 'select',\n\t\t\t\t\t'options'   =\u003e System::getCountries(),\n\t\t\t\t\t'eval'      =\u003e array('includeBlankOption' =\u003e true, 'chosen' =\u003e true, 'tl_class' =\u003e 'w50'),\n\t\t\t\t\t'sql'       =\u003e \"varchar(2) NOT NULL default ''\",\n\t\t\t\t),\n\t\t\t\t'venueSingleCoords' =\u003e array\n\t\t\t\t(\n\t\t\t\t\t'label'         =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venueSingleCoords'],\n\t\t\t\t\t'exclude'       =\u003e true,\n\t\t\t\t\t'search'        =\u003e true,\n\t\t\t\t\t'inputType'     =\u003e 'text',\n\t\t\t\t\t'eval'          =\u003e array('maxlength' =\u003e 64),\n\t\t\t\t\t'sql'           =\u003e \"varchar(64) NOT NULL default ''\",\n\t\t\t\t\t'save_callback' =\u003e array\n\t\t\t\t\t(\n\t\t\t\t\t\tarray('tl_news_plus', 'generateVenueCoords'),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\t'venueText'         =\u003e array\n\t\t\t\t(\n\t\t\t\t\t'label'     =\u003e \u0026$GLOBALS['TL_LANG']['tl_news']['venueText'],\n\t\t\t\t\t'exclude'   =\u003e true,\n\t\t\t\t\t'search'    =\u003e true,\n\t\t\t\t\t'inputType' =\u003e 'textarea',\n\t\t\t\t\t'eval'      =\u003e array('rte' =\u003e 'tinyMCE', 'tl_class' =\u003e 'clr'),\n\t\t\t\t\t'sql'       =\u003e \"text NULL\",\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t),\n);\n\n$dc['fields'] = array_merge($dc['fields'], $arrFields);\n```\n\n### Custom table setup (e.g. `tl_member_address`)\n\nIn order to use Fieldpalette with your own table, create a Data Container Array that extends from `$GLOBALS['TL_DCA']['tl_fieldpalette']`, as the following example describes.\n\n```\n\u003c?php\n/* /dca/tl_member_address.php */\n\n\\Controller::loadLanguageFile('tl_fieldpalette');\n\\Controller::loadDataContainer('tl_fieldpalette');\n\\Controller::loadDataContainer('tl_member');\n\n$GLOBALS['TL_DCA']['tl_member_address'] = $GLOBALS['TL_DCA']['tl_fieldpalette'];\n$dca                                    = \u0026$GLOBALS['TL_DCA']['tl_member_address'];\n\n$fields = [\n    'company'     =\u003e $GLOBALS['TL_DCA']['tl_member']['fields']['company'],\n    'phone'       =\u003e $GLOBALS['TL_DCA']['tl_member']['fields']['phone'],\n    'fax'         =\u003e $GLOBALS['TL_DCA']['tl_member']['fields']['fax'],\n    'street'      =\u003e $GLOBALS['TL_DCA']['tl_member']['fields']['street'],\n    'street2'     =\u003e $GLOBALS['TL_DCA']['tl_member']['fields']['street2'],\n    'postal'      =\u003e $GLOBALS['TL_DCA']['tl_member']['fields']['postal'],\n    'city'        =\u003e $GLOBALS['TL_DCA']['tl_member']['fields']['city'],\n    'state'       =\u003e $GLOBALS['TL_DCA']['tl_member']['fields']['state'],\n    'country'     =\u003e $GLOBALS['TL_DCA']['tl_member']['fields']['country'],\n    'addressText' =\u003e $GLOBALS['TL_DCA']['tl_member']['fields']['addressText'],\n];\n\n$dca['fields'] = array_merge($dca['fields'], $fields);\n```\n\nThan add the following fieldpalette input to your parent table (e.g. `tl_member`).\n\n```\n/* /dca/tl_member.php */\n\n$dca = \u0026$GLOBALS['TL_DCA']['tl_member'];\n\n/**\n* Adjust palettes\n*/\n$dca['palettes']['default'] = str_replace('country', 'country,additionalAddresses', $dca['palettes']['default']);\n\n/**\n* Adjust fields\n*/\n$dca['fields']['additionalAddresses'] = [\n    'label'        =\u003e \u0026$GLOBALS['TL_LANG']['tl_member']['additionalAddresses'],\n    'inputType'    =\u003e 'fieldpalette',\n    'foreignKey'   =\u003e 'tl_member_address.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            'table'         =\u003e 'tl_member_address',\n        ],\n        'list'     =\u003e [\n            'label' =\u003e [\n                'fields' =\u003e ['city'],\n                'format' =\u003e '%s',\n            ],\n        ],\n        'palettes' =\u003e [\n            'default' =\u003e '{contact_legend},phone,fax;{address_legend},company,street,street2,postal,city,state,country,addressText',\n        ],\n    ],\n];\n\n```\n\n### Additional dca reference\n\nAll attributes from https://docs.contao.org/books/api/dca/reference.html supported, if they are implemented yet. Additional attributes will be listed here\n\n#### Listing records\n\n##### Sorting\n\n|  Key  | Value  | Description\n|  ---  | ---  | ---\nviewMode | View mode (integer) | **0** Table (default) \u003cbr /\u003e **1** List \n\n### Support recursive copying of fieldpalette records by copying their parent record\n\nSimply add a ```oncopy_callback``` to the dca containing fields of type \"fieldpalette\":\n\n```\n$GLOBALS['TL_DCA']['tl_*'] = array\n(\n    'config'   =\u003e array\n    (\n        // ...\n        'oncopy_callback' =\u003e array(\n            array('HeimrichHannot\\FieldPalette\\FieldPalette', 'copyFieldPaletteRecords')\n        ),\n    )\n)\n```\n\n#### Manipulate fieldpalette records about to be copied on the fly\n\nSometimes your fieldpalette records contain references to other fieldpalette records. When copying them, reference ids don't match the new (copied) ids anymore.\nYou can adjust that by using the copy_callback definable in your field's dca (the field of type \"fieldpalette\"):\n\n```\n'inputType' =\u003e 'fieldpalette',\n'eval'       =\u003e array(\n    'fieldpalette' =\u003e array(\n        'copy_callback' =\u003e array(\n            array('tl_selection_model', 'updateOptionValuesOnCopy')\n        )\n    ),\n    // ...\n)\n    \n```\n\nExample for such a callback:\n\n```\npublic static function updateOptionValuesOnCopy($objFieldpalette, $intPid, $intNewId, $strTable, $arrData)\n{\n    $objFilter = \\HeimrichHannot\\FieldPalette\\FieldPaletteModel::findByPk($objFieldpalette-\u003eselectionModel_questionData_options_filter);\n\n    if ($objFilter === null)\n        return;\n\n    $objFilterNew = \\HeimrichHannot\\FieldPalette\\FieldPaletteModel::findBy(\n        array('selectionModel_questionData_filters_title=?', 'pid=?'),\n        array($objFilter-\u003eselectionModel_questionData_filters_title, $intNewId)\n    );\n\n    if ($objFilterNew !== null)\n    {\n        $objFieldpalette-\u003eselectionModel_questionData_options_filter = $objFilterNew-\u003eid;\n    }\n}\n```\n\n## Features\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","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheimrichhannot%2Fcontao-fieldpalette","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fcontao-fieldpalette/lists"}