Custom field of LISE entries in Khronos Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
10010110
Translator
Translator
Posts: 217
Joined: Tue Jan 22, 2008 9:57 am

Custom field of LISE entries in Khronos

Post by 10010110 »

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?
10010110
Translator
Translator
Posts: 217
Joined: Tue Jan 22, 2008 9:57 am

Re: Custom field of LISE entries in Khronos

Post by 10010110 »

Just for the records, this is the solution:
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;
}
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. :)
Post Reply

Return to “Modules/Add-Ons”