null,
'simplename' => null,
'simplevalue' => null,
'simpleclass' => 'd-none',
'name' => null,
'class' => null,
'id' => null,
'value' => null,
'filter' => [],
'title' => null,
'searchfield' => $prefs['tiki_object_selector_searchfield'],
'threshold' => null,
'parent' => null,
'parentkey' => null,
'format' => null,
'placeholder' => tr('Title'),
'sort' => null,
];
// Handle reserved parameters
foreach (array_keys($arguments) as $var) {
if (isset($params["_$var"])) {
$arguments[$var] = $params["_$var"];
}
unset($params["_$var"]);
}
if ($prefs['feature_search'] !== 'y') {
if ($arguments['simplename'] && isset($arguments['simplevalue'])) {
if ($params['type'] === 'trackerfield' && $arguments['separator'] === ',') {
$help = tra('Comma-separated list of field IDs');
} else {
$help = tr('%0 list separated with "%1"', ucfirst($params['type']), $arguments['separator']);
}
return "" .
"
" . $help . "
";
} else {
return tra('Object selector requires Unified Index to be enabled.');
}
}
if (empty($arguments['id'])) {
$arguments['id'] = 'object_selector_' . ++$uniqid;
}
if (empty($arguments['simpleid'])) {
$arguments['simpleid'] = 'object_selector_' . ++$uniqid;
}
if ($arguments['filter']) {
$arguments['filter'] = array_merge($arguments['filter'], $params);
} else {
$arguments['filter'] = $params;
}
if ($arguments['simplevalue'] && ! $arguments['value'] && isset($arguments['filter']['type'])) {
$arguments['value'] = "{$arguments['filter']['type']}:{$arguments['simplevalue']}";
$arguments['simpleclass'] = null;
$arguments['class'] .= ' d-none';
}
$selector = TikiLib::lib('objectselector');
$arguments['current_selection'] = $selector->read($arguments['value'], $arguments['format']);
$arguments['filter'] = json_encode($arguments['filter']);
$smarty->assign(
'object_selector',
$arguments
);
return $smarty->fetch('object_selector.tpl');
}