Add related DB fields

This commit is contained in:
Jürgen Mummert
2025-12-22 15:12:20 +01:00
parent ddf5f7172c
commit f702e8e07a
7 changed files with 153 additions and 0 deletions
@@ -0,0 +1,32 @@
<?php
use Contao\CoreBundle\DataContainer\PaletteManipulator;
$dca = &$GLOBALS['TL_DCA']['tl_calendar_events'];
PaletteManipulator::create()
->addLegend('meilisearch_legend', 'pal_expert_legend', PaletteManipulator::POSITION_AFTER)
->addField('priority', 'meilisearch_legend')
->addField('keywords', 'meilisearch_legend')
->applyToPalette('default', 'tl_calendar_events');
/**
* Priority
*/
$dca['fields']['priority'] = [
'inputType' => 'select',
'options' => [1, 2, 3],
'reference' => &$GLOBALS['TL_LANG']['MSC']['meilisearch_priority'],
'default' => 2,
'eval' => ['tl_class' => 'w50'],
'sql' => "int(1) NOT NULL default '2'"
];
/**
* Keywords
*/
$dca['fields']['keywords'] = [
'inputType' => 'text',
'eval' => ['tl_class' => 'w50', 'maxlength' => 255],
'sql' => "varchar(255) NOT NULL default ''"
];
+32
View File
@@ -0,0 +1,32 @@
<?php
use Contao\CoreBundle\DataContainer\PaletteManipulator;
$dca = &$GLOBALS['TL_DCA']['tl_news'];
PaletteManipulator::create()
->addLegend('meilisearch_legend', 'pal_expert_legend', PaletteManipulator::POSITION_AFTER)
->addField('priority', 'meilisearch_legend')
->addField('keywords', 'meilisearch_legend')
->applyToPalette('default', 'tl_news');
/**
* Priority
*/
$dca['fields']['priority'] = [
'inputType' => 'select',
'options' => [1, 2, 3],
'reference' => &$GLOBALS['TL_LANG']['MSC']['meilisearch_priority'],
'default' => 2,
'eval' => ['tl_class' => 'w50'],
'sql' => "int(1) NOT NULL default '2'"
];
/**
* Keywords
*/
$dca['fields']['keywords'] = [
'inputType' => 'text',
'eval' => ['tl_class' => 'w50', 'maxlength' => 255],
'sql' => "varchar(255) NOT NULL default ''"
];
+46
View File
@@ -0,0 +1,46 @@
<?php
use Contao\CoreBundle\DataContainer\PaletteManipulator;
$dca = &$GLOBALS['TL_DCA']['tl_page'];
PaletteManipulator::create()
->addLegend('meilisearch_legend', 'pal_expert_legend', PaletteManipulator::POSITION_AFTER)
->addField('priority', 'meilisearch_legend')
->addField('keywords', 'meilisearch_legend')
->addField('searchimage', 'meilisearch_legend')
->applyToPalette('regular', 'tl_page');
/**
* Priority
*/
$dca['fields']['priority'] = [
'inputType' => 'select',
'options' => [1, 2, 3],
'reference' => &$GLOBALS['TL_LANG']['MSC']['meilisearch_priority'],
'default' => 2,
'eval' => ['tl_class' => 'w50'],
'sql' => "int(1) NOT NULL default '2'"
];
/**
* Keywords
*/
$dca['fields']['keywords'] = [
'inputType' => 'text',
'eval' => ['tl_class' => 'w50', 'maxlength' => 255],
'sql' => "varchar(255) NOT NULL default ''"
];
/**
* Search image
*/
$dca['fields']['searchimage'] = [
'inputType' => 'fileTree',
'eval' => [
'tl_class' => 'w50',
'filesOnly' => true,
'fieldType' => 'radio'
],
'sql' => "varbinary(16) NULL"
];