Example #1
0
 public static function getAdditionalSharedColumns()
 {
     $form_config_defaults = \Taco\MrSpicy::getDefaultsArray();
     if (!array_key_exists('shared_configuration_extra_fields', $form_config_defaults)) {
         return [];
     }
     return $form_config_defaults['shared_configuration_extra_fields'];
 }
Example #2
0
 /**
  * do all the validation
  * @param  $record object
  * @return boolean
  */
 public static function checkSubmission()
 {
     // Toggle to $_GET for easy debugging locally
     $source = $_POST;
     // Verify we're using a valid Taco class
     if (!self::isTaco($source)) {
         return false;
     }
     $record = new $source['class']();
     self::$record = $record;
     // Is this an update and not a first time save
     if (array_key_exists('ID', $source)) {
         $record = $record::find($source['ID']);
     }
     // Is the nonce valid
     if (!self::isNonceValid($source, $record)) {
         return false;
     }
     // correlate the entry with the form configuration if there is one
     if (array_key_exists('form_config', $source)) {
         $record->form_config_id = $source['form_config'];
     }
     $validated = self::validateInput($record, $source);
     if (!$validated) {
         return false;
     }
     $record_info = $validated;
     // Assign info and save
     $record->assign($record_info);
     $entry_id = $record->save();
     $record->set('post_title', 'form entry - #' . $entry_id);
     $record->save();
     if (!$entry_id) {
         return false;
     }
     \Taco\MrSpicy::setEntryID($entry_id);
     self::$form_conf_id = array_key_exists('form_config', $source) ? $source['form_config'] : null;
     return true;
 }