You are here

function log_form_submit in Log entity 7

Log submit handler.

Parameters

array $form: The form array.

array $form_state: The form state array.

1 string reference to 'log_form_submit'
log_form in ./log.pages.inc
Log Form.

File

./log.pages.inc, line 235
Log pages.

Code

function log_form_submit(array $form, array &$form_state) {

  // Load the log entity from the form values.
  $log = $form_state['values']['log'];

  // Convert the date to a timestamp.
  $form_state['values']['timestamp'] = strtotime($form_state['values']['timestamp']);

  // Build the entity from the form values.
  entity_form_submit_build_entity('log', $log, $form, $form_state);

  // Save the log.
  log_save($log);

  // Redirect to the log.
  $log_uri = entity_uri('log', $log);
  $form_state['redirect'] = $log_uri['path'];

  // Print a message.
  drupal_set_message(t('Log saved: <a href="@uri">%title</a>', array(
    '@uri' => url($log_uri['path']),
    '%title' => entity_label('log', $log),
  )));
}