You are here

function _acquia_lift_navigation_attach_assets in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.module \_acquia_lift_navigation_attach_assets()

Create and attach the assets for Acquia Lift navigation to an element on the page.

Parameters

$element: The element to attach assets to.

$hide: Indicates if the navigation should be hidden by default.

1 call to _acquia_lift_navigation_attach_assets()
acquia_lift_build_page in ./acquia_lift.ui.inc
Attaches the front-end controls to the page.

File

./acquia_lift.module, line 2194
acquia_lift.module Provides Acquia Lift-specific personalization functionality.

Code

function _acquia_lift_navigation_attach_assets(&$element, $hide = FALSE) {
  $element['acquia_lift']['#access'] = user_access('manage personalized content');
  $element['acquia_lift']['#attached']['library'][] = array(
    'acquia_lift',
    'acquia_lift.personalize',
  );
  $element['acquia_lift']['#attached']['library'][] = array(
    'acquia_lift',
    'acquia_lift.message_box',
  );
  if (_acquia_lift_using_unified_navbar()) {
    $element['acquia_lift']['nav']['#type'] = 'acquia_lift_navbar';

    // Make the Acquia Lift tool bar show up after other content.
    $element['acquia_lift']['#weight'] = 100;
    $element['#sorted'] = FALSE;

    // Specific module integration libraries.
    if (module_exists('admin_menu')) {
      $element['acquia_lift']['#attached']['library'][] = array(
        'acquia_lift',
        'acquia_lift.admin_menu',
      );
    }
    else {
      if (module_exists('toolbar')) {
        $element['acquia_lift']['#attached']['library'][] = array(
          'acquia_lift',
          'acquia_lift.toolbar',
        );
      }
    }
    $element['acquia_lift']['#attached']['js'][] = array(
      'data' => array(
        'acquia_lift' => array(
          'hideTrayDefault' => $hide,
        ),
      ),
      'type' => 'setting',
    );
  }
}