function acquia_agent_toolbar_add_links in Acquia Connector 7
Same name and namespace in other branches
- 7.3 acquia_agent/acquia_agent.module \acquia_agent_toolbar_add_links()
- 7.2 acquia_agent/acquia_agent.module \acquia_agent_toolbar_add_links()
Pre-render function which dynamically adds links to the toolbar.
1 string reference to 'acquia_agent_toolbar_add_links'
- acquia_agent_page_alter in acquia_agent/
acquia_agent.module - Implement hook_page_alter().
File
- acquia_agent/
acquia_agent.module, line 59 - Acquia Agent securely sends information to Acquia Network.
Code
function acquia_agent_toolbar_add_links($toolbar) {
$link['html'] = TRUE;
if (acquia_agent_subscription_is_active()) {
$subscription = acquia_agent_settings('acquia_subscription_data');
// Yes, this uses inline CSS, which sounds bad, but including a CSS file
// just for this sounds equally bad.
$icon = '<img src="' . base_path() . 'misc/message-16-ok.png" alt="ok" style="vertical-align: middle;" />';
$link['title'] = t("!icon Subscription active (expires !date)", array(
'!icon' => $icon,
'!date' => format_date(strtotime($subscription['expiration_date']['value']), 'custom', 'Y/n/j'),
));
$link['attributes']['class'][] = "acquia-active-subscription";
$link['attributes']['title'] = $subscription['product']['view'];
$link['href'] = $subscription['href'];
}
else {
// Yes, this uses inline CSS, which sounds bad, but including a CSS file
// just for this sounds equally bad.
$icon = '<img src="' . base_path() . 'misc/message-16-error.png" alt="error" style="vertical-align: middle;" />';
$link['title'] = t("!icon Subscription not active", array(
'!icon' => $icon,
));
$link['attributes']['class'][] = "acquia-inactive-subscription";
$link['href'] = 'http://acquia.com/network';
}
$toolbar['toolbar_user']['#links'] = array_merge(array(
'acquia_agent' => $link,
), $toolbar['toolbar_user']['#links']);
return $toolbar;
}