You are here

function mandrill_activity_entity_form_submit in Mandrill 7

Same name and namespace in other branches
  1. 7.2 modules/mandrill_activity/mandrill_activity.admin.inc \mandrill_activity_entity_form_submit()

Submit handler for mandrill_activity_entity_form().

File

modules/mandrill_activity/mandrill_activity.admin.inc, line 167
Administration pages for mandrill_activity module.

Code

function mandrill_activity_entity_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  if ($form_state['op'] == 'add' || $form_state['op'] == 'clone') {
    $dummy = entity_create($form_state['values']['entity_type'], array(
      'type' => $form_state['values']['bundle'],
    ));
    $uri = entity_uri($form_state['values']['entity_type'], $dummy);
    $values['entity_path'] = $uri['path'];
    $activity_entity = entity_create('mandrill_activity_entity', $values);
  }
  else {
    $activity_entity = $form_state['mandrill_activity_entity'];
    foreach ($values as $key => $val) {
      $activity_entity->{$key} = $val;
    }
  }
  $activity_entity
    ->save();

  // Ensure the new local task appears on the entity.
  menu_rebuild();
  $form_state['redirect'] = 'admin/config/services/Mandrill/activity';
}