You are here

function references_dialog_redirect_page in References dialog 7

Page callback for our redirect page.

1 string reference to 'references_dialog_redirect_page'
references_dialog_menu in ./references_dialog.module
Implements hook_menu().

File

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

Code

function references_dialog_redirect_page($entity_id, $entity_type) {

  // Get some information about the entity we are dealing with.
  $entity = entity_load($entity_type, array(
    $entity_id,
  ));
  $entity = reset($entity);
  $entity_info = entity_get_info($entity_type);
  $entity_id = $entity->{$entity_info['entity keys']['id']};
  $entity_title = entity_label($entity_type, $entity);

  // Add appropriate javascript that will be used by the parent page to
  // fill in the required data.
  if (isset($entity_id) && references_dialog_in_dialog() && isset($_GET['references-dialog-close'])) {
    drupal_add_js(drupal_get_path('module', 'references_dialog') . '/js/references-dialog-child.js');
    drupal_add_js(array(
      'ReferencesDialog' => array(
        'entity_id' => $entity_id,
        'title' => $entity_title,
        'entity_type' => $entity_type,
      ),
    ), 'setting');
  }
  return '';
}