FIELDS_REQUIRED

Set certain fields as required on back-end editors

Accepted values: array (list of field names)

Context: Back-end (client/private.config.php)

Each module type in LiveWhale has an array of required back-end fields: 

$_LW->REGISTERED_MODULES[$module]['data_types'][$data_type]['fields_required'] = [...];

So, to require the location field when saving events, you’d add the following to private.config.php:

$_LW->REGISTERED_MODULES['events']['data_types']['events']['fields_required'][]='location';

However – when setting required fields for events, we recommend that you limit those requirements to the event editor using code like this. Reason being, if you make such fields required globally, it can block events from being loaded in from your Linked Calendars, if they’re missing those fields.

if ($_LW->page=='events_edit' || $_LW->page=='events_sub_edit') { // add additional requirements for events
        $_LW->REGISTERED_MODULES['events']['data_types']['events']['fields_required'][]='categories';
        $_LW->REGISTERED_MODULES['events']['data_types']['events']['fields_required'][]='summary';
        $_LW->REGISTERED_MODULES['events']['data_types']['events']['fields_required'][]='description';
        $_LW->REGISTERED_MODULES['events']['data_types']['events']['fields_required'][]='location';
        $_LW->REGISTERED_MODULES['events']['data_types']['events']['fields_required'][]='contact_info';
        $_LW->REGISTERED_MODULES['events']['data_types']['events']['fields_required'][]='cost_type';
        $_LW->REGISTERED_MODULES['events']['data_types']['events']['fields_required'][]='date_time';
}

In general, we discourage requiring additional fields, as it can make the editing experience more onerous, but you can choose to do so using the above examples.