/** * Get a resolved field value. * * If the form notification configuration wants a value to be returned from * a submitted field we use this, otherwise the configured parameter. * * @param string $value */ private function getConfigValue($value) { if ($this->formData->has($value)) { return $this->formData->get($value); } return $value; }
/** * Write out form data to a specified contenttype table * * @param string $contenttype * @param FormData $formData */ public function writeToContentype($contenttype, FormData $formData) { // Get an empty record for out contenttype $record = $this->app['storage']->getEmptyContent($contenttype); // Set a published date if (!$formData->has('datepublish')) { $formData->set('datepublish', date('Y-m-d H:i:s')); } foreach ($formData->keys() as $name) { // Store the data array into the record $record->setValue($name, $formData->get($name, true)); } try { $this->app['storage']->saveContent($record); } catch (\Exception $e) { $this->app['logger.system']->critical("[Bolt Forms] An exception occurred saving submission to ContentType table `{$contenttype}`", ['event' => 'extensions', 'exception' => $e]); } }