forked from gsoules/AvantSearch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig_form.php
122 lines (100 loc) · 4.8 KB
/
config_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
$view = get_view();
$storageEngine = AvantSearch::getStorageEngineForSearchTextsTable();
$titlesOnlySupported = SearchConfig::getOptionsSupportedTitlesOnly();
$addressSortingSupported = SearchConfig::getOptionSupportedAddressSorting();
$elasticsearchSupported = SearchConfig::getOptionSupportedElasticsearch();
$columnsOption = SearchConfig::getOptionTextForColumns();
$columnsOptionRows = max(2, count(explode(PHP_EOL, $columnsOption)));
$layoutsOption = SearchConfig::getOptionTextForLayouts();
$layoutsOptionRows = max(2, count(explode(PHP_EOL, $layoutsOption)));
$detailLayoutOption = SearchConfig::getOptionTextForDetailLayout();
$detailLayoutRows = max(2, count(explode(PHP_EOL, $detailLayoutOption)));
$integerSortingOption = SearchConfig::getOptionTextForIntegerSorting();
$integerSortingOptionRows = max(2, count(explode(PHP_EOL, $integerSortingOption)));
?>
<style>
.error{color:red;font-size:16px;}
.storage-engine {color:#9D5B41;margin-bottom:24px;font-weight:bold;}
</style>
<div class="plugin-help learn-more">
<a href="https://github.com/gsoules/AvantSearch#usage" target="_blank">Learn about the configuration options on this page</a>
</div>
<?php if ($storageEngine != 'InnoDB'): ?>
<?php SearchConfig::emitInnoDbMessage($storageEngine) ?>
<?php endif; ?>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_TITLES_ONLY ?></label>
</div>
<div class="inputs five columns omega">
<?php if ($titlesOnlySupported): ?>
<p class="explanation"><?php echo __('Show the option to limit keyword searching to Title text.'); ?></p>
<?php echo $view->formCheckbox(SearchConfig::OPTION_TITLES_ONLY, true, array('checked' => (boolean)get_option(SearchConfig::OPTION_TITLES_ONLY))); ?>
<?php else: ?>
<?php SearchConfig::emitOptionNotSupported('AvantSearch', 'titles-only'); ?>
<?php endif; ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_COLUMNS; ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Customization of columns in Table View search results."); ?></p>
<?php echo $view->formTextarea(SearchConfig::OPTION_COLUMNS, $columnsOption, array('rows' => $columnsOptionRows)); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_LAYOUTS; ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Layout definitions."); ?></p>
<?php echo $view->formTextarea(SearchConfig::OPTION_LAYOUTS, $layoutsOption, array('rows' => $layoutsOptionRows)); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_DETAIL_LAYOUT; ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Detail layout elements."); ?></p>
<?php echo $view->formTextarea(SearchConfig::OPTION_DETAIL_LAYOUT, $detailLayoutOption, array('rows' => $detailLayoutRows)); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_INTEGER_SORTING; ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Columns that should be sorted as integers."); ?></p>
<?php echo $view->formTextarea(SearchConfig::OPTION_INTEGER_SORTING, $integerSortingOption, array('rows' => $integerSortingOptionRows)); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_ADDRESS_SORTING; ?></label>
</div>
<div class="inputs five columns omega">
<?php if ($addressSortingSupported): ?>
<p class="explanation"><?php echo __('Sort street addresses by street name, then by street number.'); ?></p>
<?php echo $view->formCheckbox(SearchConfig::OPTION_ADDRESS_SORTING, true, array('checked' => (boolean)get_option(SearchConfig::OPTION_ADDRESS_SORTING))); ?>
<?php else: ?>
<?php SearchConfig::emitOptionNotSupported('AvantSearch', 'address-sorting'); ?>
<?php endif; ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_ELASTICSEARCH; ?></label>
</div>
<div class="inputs five columns omega">
<?php if ($elasticsearchSupported): ?>
<p class="explanation"><?php echo __('Use Elasticsearch.'); ?></p>
<?php echo $view->formCheckbox(SearchConfig::OPTION_ELASTICSEARCH, true, array('checked' => (boolean)AvantSearch::useElasticsearch())); ?>
<?php else: ?>
<?php SearchConfig::emitOptionNotSupported('AvantSearch', 'elasticsearch'); ?>
<?php endif; ?>
</div>
</div>