You are here

function acquia_lift_build_page in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 acquia_lift.ui.inc \acquia_lift_build_page()

Attaches the front-end controls to the page.

Parameters

$page: The render array of the page.

1 call to acquia_lift_build_page()
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;
  }

  // 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.
    $settings['acquia_lift']['campaigns'] = acquia_lift_get_campaign_details();

    // 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);

    // 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');
  }
}