Merge pull request #17530 from pokemaobr/REMOVING_FOREIGN_DROPDOWN_FROPM_TWIG_FUNCTIONS
Removing foreign dropdown from twig functions
This commit is contained in:
commit
4c55ff0ec4
@ -371,6 +371,18 @@ class SearchController extends AbstractController
|
||||
$htmlAttributes .= ' onfocus="return '
|
||||
. 'verifyAfterSearchFieldChange(' . $search_index . ', \'#tbl_search_form\')"';
|
||||
|
||||
$foreignDropdown = '';
|
||||
|
||||
if ($this->foreigners && $this->relation->searchColumnInForeigners($this->foreigners, $this->columnNames[$column_index]) && is_array($foreignData['disp_row'])) {
|
||||
$foreignDropdown = $this->relation->foreignDropdown(
|
||||
$foreignData['disp_row'],
|
||||
$foreignData['foreign_field'],
|
||||
$foreignData['foreign_display'],
|
||||
'',
|
||||
$GLOBALS['cfg']['ForeignKeyMaxLimit']
|
||||
);
|
||||
}
|
||||
|
||||
$value = $this->template->render('table/search/input_box', [
|
||||
'str' => '',
|
||||
'column_type' => (string) $type,
|
||||
@ -384,10 +396,10 @@ class SearchController extends AbstractController
|
||||
'foreign_data' => $foreignData,
|
||||
'table' => $GLOBALS['table'],
|
||||
'column_index' => $search_index,
|
||||
'foreign_max_limit' => $GLOBALS['cfg']['ForeignKeyMaxLimit'],
|
||||
'criteria_values' => $entered_value,
|
||||
'db' => $GLOBALS['db'],
|
||||
'in_fbs' => true,
|
||||
'foreign_dropdown' => $foreignDropdown,
|
||||
]);
|
||||
|
||||
return [
|
||||
|
||||
@ -373,6 +373,21 @@ class ZoomSearchController extends AbstractController
|
||||
$column_names_hashes[$columnName] = md5($columnName);
|
||||
}
|
||||
|
||||
$foreignDropdown = [];
|
||||
|
||||
for ($i = 0; $i == count($this->columnNames) - 1; $i++) {
|
||||
$foreignData = $this->relation->getForeignData($this->foreigners,$this->columnNames[$i],false, '', '');
|
||||
if ($this->foreigners && $this->relation->searchColumnInForeigners($this->foreigners, $this->columnNames[$i]) && is_array($foreignData['disp_row'])) {
|
||||
$foreignDropdown[$i] = $this->relation->foreignDropdown(
|
||||
$foreignData['disp_row'],
|
||||
$foreignData['foreign_field'],
|
||||
$foreignData['foreign_display'],
|
||||
'',
|
||||
$GLOBALS['cfg']['ForeignKeyMaxLimit']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->render('table/zoom_search/result_form', [
|
||||
'db' => $GLOBALS['db'],
|
||||
'table' => $GLOBALS['table'],
|
||||
@ -385,7 +400,7 @@ class ZoomSearchController extends AbstractController
|
||||
'data' => $data,
|
||||
'data_json' => json_encode($data),
|
||||
'zoom_submit' => isset($_POST['zoom_submit']),
|
||||
'foreign_max_limit' => $GLOBALS['cfg']['ForeignKeyMaxLimit'],
|
||||
'foreign_dropdown' => $foreignDropdown,
|
||||
]);
|
||||
}
|
||||
|
||||
@ -436,6 +451,18 @@ class ZoomSearchController extends AbstractController
|
||||
$htmlAttributes .= ' onfocus="return '
|
||||
. 'verifyAfterSearchFieldChange(' . $search_index . ', \'#zoom_search_form\')"';
|
||||
|
||||
$foreignDropdown = '';
|
||||
|
||||
if ($this->foreigners && $this->relation->searchColumnInForeigners($this->foreigners, $this->columnNames[$column_index]) && is_array($foreignData['disp_row'])) {
|
||||
$foreignDropdown = $this->relation->foreignDropdown(
|
||||
$foreignData['disp_row'],
|
||||
$foreignData['foreign_field'],
|
||||
$foreignData['foreign_display'],
|
||||
'',
|
||||
$GLOBALS['cfg']['ForeignKeyMaxLimit']
|
||||
);
|
||||
}
|
||||
|
||||
$value = $this->template->render('table/search/input_box', [
|
||||
'str' => '',
|
||||
'column_type' => (string) $type,
|
||||
@ -449,10 +476,10 @@ class ZoomSearchController extends AbstractController
|
||||
'foreign_data' => $foreignData,
|
||||
'table' => $GLOBALS['table'],
|
||||
'column_index' => $search_index,
|
||||
'foreign_max_limit' => $GLOBALS['cfg']['ForeignKeyMaxLimit'],
|
||||
'criteria_values' => $entered_value,
|
||||
'db' => $GLOBALS['db'],
|
||||
'in_fbs' => true,
|
||||
'foreign_dropdown' => $foreignDropdown,
|
||||
]);
|
||||
|
||||
return [
|
||||
|
||||
@ -20,11 +20,6 @@ class RelationExtension extends AbstractExtension
|
||||
$relation = new Relation($GLOBALS['dbi']);
|
||||
|
||||
return [
|
||||
new TwigFunction(
|
||||
'foreign_dropdown',
|
||||
[$relation, 'foreignDropdown'],
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_display_field',
|
||||
[$relation, 'getDisplayField'],
|
||||
|
||||
@ -3,13 +3,7 @@
|
||||
{% if foreign_data['disp_row'] is iterable %}
|
||||
<select name="criteriaValues[{{ column_index }}]"
|
||||
id="{{ column_id }}{{ column_index }}">
|
||||
{{ foreign_dropdown(
|
||||
foreign_data['disp_row'],
|
||||
foreign_data['foreign_field'],
|
||||
foreign_data['foreign_display'],
|
||||
'',
|
||||
foreign_max_limit
|
||||
) }}
|
||||
{{ foreign_dropdown }}
|
||||
</select>
|
||||
{% elseif foreign_data['foreign_link'] == true %}
|
||||
<input type="text"
|
||||
|
||||
@ -65,7 +65,8 @@
|
||||
'foreign_max_limit': foreign_max_limit,
|
||||
'criteria_values': '',
|
||||
'db': db,
|
||||
'in_fbs': false
|
||||
'in_fbs': false,
|
||||
'foreign_dropdown': foreign_dropdown[column_index]
|
||||
} only %}
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user