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"
];
@@ -0,0 +1,7 @@
<?php
$GLOBALS['TL_LANG']['MSC']['meilisearch_priority'] = [
1 => 'Niedrig',
2 => 'Standard',
3 => 'Hoch',
];
@@ -0,0 +1,11 @@
<?php
// Legend
$GLOBALS['TL_LANG']['tl_calendar_events']['meilisearch_legend'] = 'Einstellungen für die Suche';
// Fields
$GLOBALS['TL_LANG']['tl_calendar_events']['priority'][0] = 'Priorität';
$GLOBALS['TL_LANG']['tl_calendar_events']['priority'][1] = 'Priorität für die Darstellung in den Suchergebnissen (1 = niedrig, 3 = hoch).';
$GLOBALS['TL_LANG']['tl_calendar_events']['keywords'][0] = 'Keywords';
$GLOBALS['TL_LANG']['tl_calendar_events']['keywords'][1] = 'Zusätzliche Suchbegriffe für die Indexierung.';
@@ -0,0 +1,11 @@
<?php
// Legend
$GLOBALS['TL_LANG']['tl_news']['meilisearch_legend'] = 'Einstellungen für die Suche';
// Fields
$GLOBALS['TL_LANG']['tl_news']['priority'][0] = 'Priorität';
$GLOBALS['TL_LANG']['tl_news']['priority'][1] = 'Priorität für die Darstellung in den Suchergebnissen (1 = niedrig, 3 = hoch).';
$GLOBALS['TL_LANG']['tl_news']['keywords'][0] = 'Keywords';
$GLOBALS['TL_LANG']['tl_news']['keywords'][1] = 'Zusätzliche Suchbegriffe für die Indexierung.';
@@ -0,0 +1,14 @@
<?php
// Legend
$GLOBALS['TL_LANG']['tl_page']['meilisearch_legend'] = 'Einstellungen für die Suche';
// Fields
$GLOBALS['TL_LANG']['tl_page']['priority'][0] = 'Priorität';
$GLOBALS['TL_LANG']['tl_page']['priority'][1] = 'Priorität für die Darstellung in den Suchergebnissen (1 = niedrig, 3 = hoch).';
$GLOBALS['TL_LANG']['tl_page']['keywords'][0] = 'Keywords';
$GLOBALS['TL_LANG']['tl_page']['keywords'][1] = 'Zusätzliche Suchbegriffe für die Indexierung.';
$GLOBALS['TL_LANG']['tl_page']['searchimage'][0] = 'Suchbild';
$GLOBALS['TL_LANG']['tl_page']['searchimage'][1] = 'Vorschaubild für die Anzeige in Suchergebnissen.';