Add Settings
This commit is contained in:
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Contao\CoreBundle\DataContainer\PaletteManipulator;
|
||||||
|
use Contao\System;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields
|
||||||
|
*/
|
||||||
|
$GLOBALS['TL_DCA']['tl_settings']['fields']['meilisearch_host'] = [
|
||||||
|
'inputType' => 'text',
|
||||||
|
'eval' => [
|
||||||
|
'mandatory' => true,
|
||||||
|
'rgxp' => 'url',
|
||||||
|
'tl_class' => 'w50',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$GLOBALS['TL_DCA']['tl_settings']['fields']['meilisearch_index'] = [
|
||||||
|
'inputType' => 'text',
|
||||||
|
'eval' => [
|
||||||
|
'mandatory' => true,
|
||||||
|
'tl_class' => 'w50',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$GLOBALS['TL_DCA']['tl_settings']['fields']['meilisearch_api'] = [
|
||||||
|
'inputType' => 'text',
|
||||||
|
'eval' => [
|
||||||
|
'mandatory' => true,
|
||||||
|
'tl_class' => 'w50',
|
||||||
|
'hideInput' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$GLOBALS['TL_DCA']['tl_settings']['fields']['meilisearch_imagesize'] = [
|
||||||
|
'inputType' => 'select',
|
||||||
|
'options_callback' => static function () {
|
||||||
|
$db = System::getContainer()->get('database_connection');
|
||||||
|
$rows = $db->fetchAllAssociative('SELECT id, name FROM tl_image_size ORDER BY name');
|
||||||
|
|
||||||
|
$options = ['' => '-'];
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$options[$row['id']] = $row['name'] . ' (ID ' . $row['id'] . ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
},
|
||||||
|
'eval' => [
|
||||||
|
'tl_class' => 'w50',
|
||||||
|
'chosen' => true,
|
||||||
|
'includeBlankOption' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Palette
|
||||||
|
*/
|
||||||
|
PaletteManipulator::create()
|
||||||
|
->addLegend('meilisearch_legend', null, PaletteManipulator::POSITION_AFTER, true)
|
||||||
|
->addField('meilisearch_host', 'meilisearch_legend')
|
||||||
|
->addField('meilisearch_index', 'meilisearch_legend')
|
||||||
|
->addField('meilisearch_api', 'meilisearch_legend')
|
||||||
|
->addField('meilisearch_imagesize', 'meilisearch_legend')
|
||||||
|
->applyToPalette('default', 'tl_settings');
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$GLOBALS['TL_LANG']['tl_settings']['meilisearch_legend'] = 'Meilisearch Einstellungen';
|
||||||
|
|
||||||
|
$GLOBALS['TL_LANG']['tl_settings']['meilisearch_host'][0] = 'Meilisearch URL';
|
||||||
|
$GLOBALS['TL_LANG']['tl_settings']['meilisearch_host'][1] = 'URL der Meilisearch Instanz (z. B. https://search.domain.tld).';
|
||||||
|
|
||||||
|
$GLOBALS['TL_LANG']['tl_settings']['meilisearch_index'][0] = 'Meilisearch Index';
|
||||||
|
$GLOBALS['TL_LANG']['tl_settings']['meilisearch_index'][1] = 'Index in der Meilisearch Instanz.';
|
||||||
|
|
||||||
|
$GLOBALS['TL_LANG']['tl_settings']['meilisearch_api'][0] = 'API Key';
|
||||||
|
$GLOBALS['TL_LANG']['tl_settings']['meilisearch_api'][1] = 'API-Schlüssel für den Zugriff auf Meilisearch.';
|
||||||
|
|
||||||
|
$GLOBALS['TL_LANG']['tl_settings']['meilisearch_imagesize'][0] = 'Bildgröße für Vorschaubilder';
|
||||||
|
$GLOBALS['TL_LANG']['tl_settings']['meilisearch_imagesize'][1] = 'Bildgröße aus den Contao-Bildgrößen (tl_image_size).';
|
||||||
Reference in New Issue
Block a user