For running J!5.1 you must https://fabrikar.com/forums/index.php?wiki/update-from-github/ or include the new file manually https://fabrikar.com/forums/index.php?threads/joomla-5-1-and-fabrik-cannot-find-files-error.54473/post-285151 See also Announcements
Please see our announcement here.
$db = FabrikWorker::getDbo();
$query = $db->getQuery(true);
// replace 'reasons' with your table name
$query->select('*')->from('reasons');
$db->setQuery($query);
$reasons = $db->loadObjectList();
$style = array();
foreach ($reasons as $r) {
// replace 'reason' with the reason element on the events list, and 'id' and 'color' with the appropriate field names from reasons table
$style = 'reason' . $r->id . ' { backgroundcolor: rgb(' . $r->color . '); }';
}
FabrikHelperHTML::addStyleDeclaration(implode("\n", $style));