function organigrams_view_page in Organigrams 7
Menu callback to display an organigram.
Parameters
mixed $organigram: An organigram entity, ID or machine name.
Return value
array A renderable array or drupal not found.
1 string reference to 'organigrams_view_page'
- organigrams_menu in ./
organigrams.module - Implements hook_menu().
File
- ./
organigrams.module, line 591 - Defines the organigrams functions and entity types.
Code
function organigrams_view_page($organigram) {
// Show the not found page if no argument is given.
if (empty($organigram)) {
drupal_not_found();
}
// Retrieve the organigram by ID or by machine name.
if (!is_numeric($organigram) && is_string($organigram)) {
// Load the organigram by machine name.
$organigram = organigrams_machine_name_load($organigram);
}
elseif (is_numeric($organigram)) {
$organigram = organigrams_load($organigram);
}
// Show the not found page if no organigram is loaded.
if (empty($organigram)) {
drupal_not_found();
}
// Do an access check.
if (!organigrams_entity_access('view', $organigram)) {
drupal_access_denied();
}
// Generate the organigram renderable array.
$content = entity_view('organigrams', array(
$organigram,
), 'organigram');
return $content;
}