Custom field of LISE entries in Khronos Topic is solved
Custom field of LISE entries in Khronos
Is there a way to have a custom select field of LISE entries in Khronos? I suppose this would be solved with the “dropdown from UDT” but how is this achieved?
Re: Custom field of LISE entries in Khronos
Just for the records, this is the solution:
Create a user defined tag.
Paste this code in:
Create a custom field of type “dropdown from UDT” in Khronos settings and select this UDT. You should now see the LISE entries in a select field in the event edit screen.
Thanks velden and JoMorg.
Create a user defined tag.
Paste this code in:
Code: Select all
$mod = \cms_utils::get_module('LISE instance name here'); // put the name of the LISE instance here!!!
if( !is_object($mod) ) {
/* probably handle errors */
return;
}
$item_query = $mod->GetItemQuery($params);
$item_query->AppendTo(LISEQuery::VARTYPE_WHERE, 'A.active = 1');
$result = $item_query->Execute(true);
$items = [''];
while($result && $row = $result->FetchRow()) {
$obj = $mod->LoadItemByIdentifier('item_id', $row['item_id']);
$items[$row['item_id']] = $obj->title;
// $totalcount = $item_query->TotalCount(); // overbodig?
}
if(isset($params['assign']) ) {
$smarty->assign($params['assign'], $items);
}
else {
return $items;
}
Thanks velden and JoMorg.