You are here

function organigrams_redirect_to_view_page in Organigrams 7

Admin menu callback to redirect to the organigram view page.

Parameters

mixed $organigram: An organigram entity or machine name.

1 string reference to 'organigrams_redirect_to_view_page'
organigrams_menu in ./organigrams.module
Implements hook_menu().

File

./organigrams.module, line 557
Defines the organigrams functions and entity types.

Code

function organigrams_redirect_to_view_page($organigram) {

  // Show not found page if no argument is given.
  if (empty($organigram)) {
    drupal_not_found();
  }

  // Define the var.
  $machine_name = '';

  // Get the machine name.
  if (is_string($organigram)) {
    $machine_name = $organigram;
  }
  elseif (isset($organigram->machine_name)) {
    $machine_name = $organigram->machine_name;
  }
  else {

    // If no machine name is found, show not found page.
    drupal_not_found();
  }

  // Redirect to the organigram view page.
  drupal_goto('organigram/' . $machine_name);
}