You are here

function heartbeat_activity_form_submit in Heartbeat 7

Submit handler to save an heartbeat activity entity.

1 string reference to 'heartbeat_activity_form_submit'
heartbeat_activity_form in ./heartbeat.entity.inc
Generate the heartbeat activity add/edit form. This entity form is always referenced to a stream.

File

./heartbeat.entity.inc, line 323

Code

function heartbeat_activity_form_submit($form, &$form_state) {

  //form_execute_handlers('submit', $form, $form_state);
  $heartbeatActivity = $form_state['heartbeat_activity'];

  //$form['#heartbeat_stream']->presaveActivityMessage($heartbeatActivity);
  entity_form_submit_build_entity('heartbeat_activity', $heartbeatActivity, $form, $form_state);
  $heartbeatActivity->timestamp = $_SERVER['REQUEST_TIME'];

  // Prepare the fields.
  field_attach_presave('heartbeat_activity', $heartbeatActivity);
  module_invoke_all('heartbeat_activity_presave', $heartbeatActivity);

  // Save the record to the activity table.
  $saved = $heartbeatActivity
    ->save();

  // Save fields.
  field_attach_insert("heartbeat_activity", $heartbeatActivity);

  // Invoke the heartbeat activity hooks.
  module_invoke_all("heartbeat_activity_insert", $heartbeatActivity);
  module_invoke_all("entity_insert", $heartbeatActivity, 'heartbeat_activity');
  entity_get_controller('heartbeat_activity')
    ->resetCache(array(
    $heartbeatActivity->uaid,
  ));
}