function acquia_lift_build_page in Acquia Lift Connector 7
Same name and namespace in other branches
- 7.2 acquia_lift.ui.inc \acquia_lift_build_page()
Attaches the front-end controls to the page.
Parameters
$page: The render array of the page.
2 calls to acquia_lift_build_page()
- AcquiaLiftWebTestWorkflow::testVerificationChecks in tests/
acquia_lift.test - Tests the effect of the acquia_lift_unibar_allow_status_change variable to prevent verification checks on every page load.
- acquia_lift_page_build in ./
acquia_lift.module - Implements hook_page_build().
File
- ./
acquia_lift.ui.inc, line 39 - acquia_lift.ui.inc Provides functions needed for the front-end UI.
Code
function acquia_lift_build_page(&$page) {
// Attach the editor app toggle code on all non-admin pages.
// A special case is made for the block demo page which is not properly
// marked as an admin page by path_is_admin().
$is_admin = TRUE;
if (!path_is_admin(current_path()) && preg_match('/^admin\\/structure\\/block\\/demo\\//', current_path()) == 0) {
$is_admin = FALSE;
// If the user is personalizing content in context, provide a DSM with actions
// to personalize or cancel out of this 'mode'.
if (acquia_lift_nav_message_is_set()) {
drupal_set_message(acquia_lift_edit_mode_personalize_in_context(), 'acquia-lift-personalize');
}
}
// Attach client-side controls for managing personalized content.
_acquia_lift_navigation_attach_assets($page['page_top'], $is_admin);
// Necessary ctools integration for modal windows. These are used only for
// administrative functionality.
if (user_access('manage personalized content')) {
ctools_include('modal');
ctools_include('ajax');
ctools_modal_add_js();
// Have to add styling here. When added as part of a library it is always
// added before ctools and therefore cannot override styles.
$page['page_top']['#attached']['library'][] = array(
'acquia_lift',
'acquia_lift.modal',
);
ctools_add_css('acquia_lift.ctools.modal', 'acquia_lift');
// Load data about active campaigns.
$include_status = variable_get('acquia_lift_unibar_allow_status_change', TRUE);
$settings['acquia_lift']['campaigns'] = acquia_lift_get_campaign_details($include_status);
$settings['acquia_lift']['allowStatusChange'] = (bool) $include_status;
// Load data about custom defined visitor actions.
$actions = visitor_actions_custom_load_multiple();
$settings['acquia_lift']['customActions'] = $actions;
$settings['acquia_lift']['dom_selector_ignore'] = acquia_lift_generate_ignore_selector();
$settings['acquia_lift']['edit_in_context_html_strip'] = variable_get('acquia_lift_html_context_strip', 1);
$pending_agents = acquia_lift_get_pending_agents();
if (!empty($pending_agents)) {
$settings['acquia_lift']['pendingMessage'][] = t('The following campaigns are being synced to Lift and will be started shortly: %agents', array(
'%agents' => implode(', ', $pending_agents),
));
$page['page_top']['#attached']['library'][] = array(
'acquia_lift',
'acquia_lift.messagebox',
);
}
// Add any pending messages from the query string.
$params = drupal_get_query_parameters();
if (!empty($params['liftpm']) && strstr($params['liftpm'], '|') !== FALSE) {
list($type, $details) = explode('|', $params['liftpm']);
if ($type === 'new_block') {
$settings['acquia_lift']['pendingMessage'][] = t('Created the new %block_title personalized block. The block will not appear on your website until you add the block to a region on the !blocks page.', array(
'%block_title' => $details,
'!blocks' => l('Structure > Blocks', 'admin/structure/blocks'),
));
}
}
drupal_add_js($settings, 'setting');
}
}