onFormatPublicSubmission

The onFormatPublicSubmission handler is called after a public submission has been received, validated with no errors, and is just about to be saved to your database. The $buffer field contains all of the fields that will go into the $_LW->create function, and this handler lets you filter them, add or remove arguments, etc. See below for an example module.

<?php
     $_LW->REGISTERED_APPS['my_app']=[
       'title'=>'My App',
       'handlers'=>['onFormatPublicSubmission'],
    ];

    class LiveWhaleApplicationMyApp {

      public function onFormatPublicSubmission($data_type, $buffer) {
      global $_LW;
      if ($data_type=='events') { // on before submission of an event
        if (!empty($_LW->_POST['custom_tags'])) { // if custom tags were checked off, assign to event tags
          if (is_array($_LW->_POST['custom_tags'])) {
            $buffer['associated_data']['tags'] = $_LW->setFormatClean($_LW->_POST['global_tags']);
          }
        }
      };
      return $buffer;
      }

   }
?>