You are here

function references_dialog_close_on_redirect in References dialog 7

Sets our destination parameter so that the dialog will close itself after redirect is completed.

2 calls to references_dialog_close_on_redirect()
references_dialog_entity_insert in ./references_dialog.module
Implements hook_entity_insert().
references_dialog_entity_update in ./references_dialog.module
Implements hook_entity_update().

File

./references_dialog.module, line 543
This the main module file.

Code

function references_dialog_close_on_redirect($entity, $entity_type) {
  $entity_info = entity_get_info($entity_type);

  // We use $_GET['destination'] since that overrides anything that happens
  // in the form. It is a hack, but it is very effective, since we don't have
  // to be worried about getting overrun by other form submit handlers.
  $_GET['destination'] = 'references-dialog/redirect/' . $entity->{$entity_info['entity keys']['id']} . '/' . $entity_type . '?references-dialog-close=1&render=references-dialog';
}