function deploy_ui_overview_page in Deploy - Content Staging 7.2
Page callback for the overview page.
1 string reference to 'deploy_ui_overview_page'
- deploy_ui_menu in modules/
deploy_ui/ deploy_ui.module - Implementation of hook_menu().
File
- modules/
deploy_ui/ deploy_ui.pages.inc, line 10 - Deploy UI page functions.
Code
function deploy_ui_overview_page() {
$plans = deploy_plan_load_all_enabled();
$blocks = array();
// Iterate over all plans.
foreach ($plans as $plan) {
$info = array();
// Get the entity keys from the aggregator.
$entity_keys = $plan
->getEntities();
foreach ($entity_keys as $entity_key) {
// Get the entity info and all entities of this type.
$entity_info = entity_get_info($entity_key['type']);
if (!empty($entity_info['entity keys']['revision']) && !empty($entity_key['revision_id'])) {
$entity = entity_revision_load($entity_key['type'], $entity_key['revision_id']);
}
else {
$entity = entity_load_single($entity_key['type'], $entity_key['id']);
}
$title = "{$entity_key['type']}:{$entity_key['id']}";
$label = entity_label($entity_key['type'], $entity);
if ($label) {
$title = $label;
}
if ($entity_info['entity keys']['revision'] && !empty($entity_key['revision_id'])) {
$title = t('@title (rev:@rev_id)', array(
'@title' => $title,
'@rev_id' => $entity_key['revision_id'],
));
}
// Some entities fail fatally with entity_uri() and
// entity_extract_ids(). So handle this gracefully.
try {
$uri = entity_uri($entity_key['type'], $entity);
if ($uri) {
$title = l($title, $uri['path'], $uri['options']);
}
} catch (Exception $e) {
watchdog_exception('deploy_ui', $e);
}
// Construct a usable array for the theme function.
$info[] = array(
'title' => $title,
'type' => $entity_info['label'],
);
}
// Construct a usable array for the theme function.
$blocks[] = array(
'plan_name' => check_plain($plan->name),
'plan_title' => check_plain($plan->title),
'plan_description' => check_plain($plan->description),
'content' => theme('deploy_ui_overview_plan_content', array(
'info' => $info,
)),
'fetch_only' => $plan->fetch_only,
'status' => deploy_plan_get_status($plan->name),
);
}
return theme('deploy_ui_overview', array(
'blocks' => $blocks,
));
}