meilisearch/Configuration/SiteConfiguration/Overrides/sites.php

182 lines
6.7 KiB
PHP
Raw Normal View History

2021-04-17 00:26:33 +02:00
<?php
/**
2021-04-17 21:20:54 +02:00
* Global Meilisearch Connection Settings
2021-04-17 00:26:33 +02:00
*/
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_enabled_read'] = [
'label' => 'Enable Meilisearch for this site',
2021-04-17 00:26:33 +02:00
'onChange' => 'reload',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'default' => 1,
'items' => [
[
0 => '',
1 => ''
]
]
],
];
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_scheme_read'] = [
2021-04-17 00:26:33 +02:00
'label' => 'Scheme',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['http', 'http'],
['https', 'https'],
],
'size' => 1,
'minitems' => 0,
'maxitems' => 1
],
2021-04-17 21:20:54 +02:00
'displayCond' => 'FIELD:meilisearch_enabled_read:=:1'
2021-04-17 00:26:33 +02:00
];
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_host_read'] = [
2021-04-17 00:26:33 +02:00
'label' => 'Host',
'config' => [
'type' => 'input',
'default' => 'localhost',
'placeholder' => 'localhost',
'size' => 10
],
2021-04-17 21:20:54 +02:00
'displayCond' => 'FIELD:meilisearch_enabled_read:=:1'
2021-04-17 00:26:33 +02:00
];
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_port_read'] = [
2021-04-17 00:26:33 +02:00
'label' => 'Port',
'config' => [
'type' => 'input',
'eval' => 'required',
'size' => 5,
2021-04-17 21:20:54 +02:00
'default' => 7700
],
'displayCond' => 'FIELD:meilisearch_enabled_read:=:1'
];
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_masterkey_read'] = [
'label' => 'Master key',
'config' => [
'type' => 'input',
'eval' => 'required',
'size' => 20,
'default' => ''
2021-04-17 00:26:33 +02:00
],
2021-04-17 21:20:54 +02:00
'displayCond' => 'FIELD:meilisearch_enabled_read:=:1'
2021-04-17 00:26:33 +02:00
];
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_path_read'] = [
'label' => 'URL path to Meilisearch server',
'description' => 'I.e. if you use Hosted-Meilisearch.com the path inside the admin panel. Should not contain "/meilisearch/".',
2021-04-17 00:26:33 +02:00
'config' => [
'type' => 'input',
'eval' => 'required',
'default' => '/'
],
2021-04-17 21:20:54 +02:00
'displayCond' => 'FIELD:meilisearch_enabled_read:=:1'
2021-04-17 00:26:33 +02:00
];
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_use_write_connection'] = [
2021-04-17 00:26:33 +02:00
'label' => 'Use different write connection',
'onChange' => 'reload',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'default' => 0,
'items' => [
[
0 => '',
1 => ''
]
]
],
2021-04-17 21:20:54 +02:00
'displayCond' => 'FIELD:meilisearch_enabled_read:=:1'
2021-04-17 00:26:33 +02:00
];
// write TCA
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_scheme_write'] = $GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_scheme_read'];
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_scheme_write']['displayCond'] = 'FIELD:meilisearch_use_write_connection:=:1';
2021-04-17 00:26:33 +02:00
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_port_write'] = $GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_port_read'];
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_port_write']['config']['eval'] = '';
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_port_write']['displayCond'] = 'FIELD:meilisearch_use_write_connection:=:1';
2021-04-17 00:26:33 +02:00
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_host_write'] = $GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_host_read'];
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_host_write']['config']['eval'] = '';
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_host_write']['displayCond'] = 'FIELD:meilisearch_use_write_connection:=:1';
2021-04-17 00:26:33 +02:00
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_path_write'] = $GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_path_read'];
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_path_write']['config']['eval'] = '';
$GLOBALS['SiteConfiguration']['site']['columns']['meilisearch_path_write']['displayCond'] = 'FIELD:meilisearch_use_write_connection:=:1';
2021-04-17 00:26:33 +02:00
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['palettes']['meilisearch_read']['showitem'] = 'meilisearch_scheme_read, meilisearch_host_read, meilisearch_port_read, meilisearch_path_read';
$GLOBALS['SiteConfiguration']['site']['palettes']['meilisearch_write']['showitem'] = 'meilisearch_scheme_write, meilisearch_host_write, meilisearch_port_write, meilisearch_path_write';
2021-04-17 00:26:33 +02:00
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site']['types']['0']['showitem'] .= ',--div--;Meilisearch,meilisearch_enabled_read,--palette--;;meilisearch_read, meilisearch_use_write_connection,--palette--;;meilisearch_write';
2021-04-17 00:26:33 +02:00
/**
* Language specific core configuration
*/
2021-04-17 21:20:54 +02:00
$GLOBALS['SiteConfiguration']['site_language']['columns']['meilisearch_core_read'] = [
2021-04-17 00:26:33 +02:00
'label' => 'Corename',
'config' => [
'type' => 'input',
'eval' => 'trim',
'valuePicker' => [
'items' => [
[ 'Arabic', 'core_ar'],
[ 'Armenian', 'core_hy'],
[ 'Basque', 'core_eu'],
[ 'Brazilian Portuguese', 'core_ptbr'],
[ 'Bulgarian', 'core_bg'],
[ 'Burmese', 'core_my'],
[ 'Catalan', 'core_ca'],
[ 'Chinese', 'core_zh'],
[ 'Czech', 'core_cs'],
[ 'Danish', 'core_da'],
[ 'Dutch', 'core_nl'],
[ 'English', 'core_en'],
[ 'Finnish', 'core_fi'],
[ 'French', 'core_fr'],
[ 'Galician', 'core_gl'],
[ 'German', 'core_de'],
[ 'Greek', 'core_el'],
[ 'Hinde', 'core_hi'],
[ 'Hungarian', 'core_hu'],
[ 'Indonesian', 'core_id'],
[ 'Irish', 'core_ie'],
[ 'Italian', 'core_it'],
[ 'Japanese', 'core_ja'],
[ 'Korean', 'core_km'],
[ 'Lao', 'core_lo'],
[ 'Latvia', 'core_lv'],
[ 'Norwegian', 'core_no'],
[ 'Persian', 'core_fa'],
[ 'Polish', 'core_pl'],
[ 'Portuguese', 'core_pt'],
[ 'Romanian', 'core_ro'],
[ 'Russian', 'core_ru'],
[ 'Serbian', 'core_rs'],
[ 'Spanish', 'core_es'],
[ 'Swedish', 'core_sv'],
[ 'Thai', 'core_th'],
[ 'Turkish', 'core_tr'],
[ 'Ukrainian', 'core_uk'],
],
],
'placeholder' => 'core_*',
]
];
$GLOBALS['SiteConfiguration']['site_language']['types']['1']['showitem'] = str_replace(
'flag',
2021-04-17 21:20:54 +02:00
'flag, meilisearch_core_read, ',
2021-04-17 00:26:33 +02:00
$GLOBALS['SiteConfiguration']['site_language']['types']['1']['showitem']
);