Skip to content

Commit

Permalink
optimize event loading (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaphoneJon authored Oct 27, 2024
1 parent 441d86d commit 7979edb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,15 @@ public function wf_crm_get_states($param = NULL) {
* @return array
*/
function wf_crm_get_events($reg_options, $context) {
$ret = [];
static $ret = [];
if ($ret && $context !== 'config_form') {
return $ret;
}
$format = wf_crm_aval($reg_options, 'title_display', 'title');
$sort_field = wf_crm_aval($reg_options, 'event_sort_field', 'start_date');
$sort_order = ($context == 'config_form' && $sort_field === 'start_date') ? ' DESC' : '';
$params = [
'return' => ['id', 'title', 'start_date', 'end_date', 'event_type_id', 'max_participants'],
'is_template' => 0,
'is_active' => 1,
];
Expand Down

0 comments on commit 7979edb

Please sign in to comment.