You are here

function _acquia_lift_build_menu in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 acquia_lift.install \_acquia_lift_build_menu()

Helper function to generate the menus for the Acquia Lift controls.

Parameters

$menu_name: The name of the acquia lift controls menu in router system.

14 calls to _acquia_lift_build_menu()
acquia_lift_enable in ./acquia_lift.install
Implements hook_enable().
acquia_lift_update_7004 in ./acquia_lift.install
Fix options for links.
acquia_lift_update_7005 in ./acquia_lift.install
Update Acquia Lift control links to simplified IA structure.
acquia_lift_update_7006 in ./acquia_lift.install
Update Acquia Lift links for usability.
acquia_lift_update_7007 in ./acquia_lift.install
Update the campaigns menu to use simplified campaign modal process.

... See full list

File

./acquia_lift.install, line 150
Acquia Lift - Installation file.

Code

function _acquia_lift_build_menu($menu_name) {

  // Create a link for attaching option set preview triggers.
  $item = array(
    'link_title' => 'Personalizations',
    'link_path' => 'admin/structure/personalize',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize' => 'campaigns',
        'class' => array(
          'acquia-lift-campaign-list',
          'visitor-actions-ui-ignore',
        ),
        'id' => 'acquia-lift-menu-campaigns',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 1,
  );
  $item_campaign = menu_link_save($item);

  // Create a new campaign link.
  $item = array(
    'link_title' => 'Add personalization',
    'link_path' => 'admin/structure/personalize/add',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize-mode' => 'campaign',
        'aria-role' => 'button',
        'aria-pressed' => 'false',
        'class' => array(
          'visitor-actions-ui-ignore',
          'acquia-lift-menu-create',
          'acquia-lift-menu-link',
          'overlay-exclude',
        ),
        'id' => 'acquia-lift-menu-campaign-add',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 1,
    'plid' => $item_campaign,
  );
  menu_link_save($item);

  // Create a link to the all campaigns page.
  $item = array(
    'link_title' => 'All personalizations',
    'link_path' => 'admin/structure/personalize',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'aria-role' => 'button',
        'aria-pressed' => 'false',
        'class' => array(
          'visitor-actions-ui-ignore',
          'acquia-lift-menu-all',
          'acquia-lift-menu-link',
          'overlay-exclude',
        ),
        'id' => 'acquia-lift-menu-campaign-all',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 9,
    'plid' => $item_campaign,
  );
  menu_link_save($item);

  // Create a link for attaching option sets.
  $item = array(
    'link_title' => 'What',
    'link_path' => 'admin/structure/personalize',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize' => 'option_sets',
        'class' => array(
          'acquia-lift-option-sets-list',
          'visitor-actions-ui-ignore',
          'overlay-exclude',
        ),
        'id' => 'acquia-lift-menu-option-sets',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 2,
  );
  $item_cv = menu_link_save($item);

  // Create a link for attaching option set preview triggers.
  $item = array(
    'link_title' => 'Add variation set',
    'link_path' => 'admin/structure/acquia_lift/variations/add/nojs',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize-mode' => 'content-variation',
        'role' => 'button',
        'aria-pressed' => 'false',
        'class' => array(
          'acquia-lift-option-sets-new',
          'visitor-actions-ui-ignore',
          'acquia-lift-menu-create',
          'acquia-lift-menu-link',
          'overlay-exclude',
          'ctools-use-modal',
          'ctools-modal-acquia-lift-style',
        ),
        'id' => 'acquia-lift-menu-option-set-add',
      ),
      'html' => FALSE,
      'fragment' => 'content-variations',
    ),
    'expanded' => 1,
    'weight' => 3,
    'plid' => $item_cv,
  );
  menu_link_save($item);

  // Create a link for listing Goals.
  $item = array(
    'link_title' => 'Why',
    'link_path' => 'admin/structure/personalize',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize' => 'goals',
        'class' => array(
          'acquia-lift-goals-list',
          'visitor-actions-ui-ignore',
          'overlay-exclude',
        ),
        'id' => 'acquia-lift-menu-goals',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 3,
  );
  $item_goal = menu_link_save($item);

  // Create a link for attaching Goals.
  $item = array(
    'link_title' => 'Add goal',
    'link_path' => 'admin/structure/acquia_lift/goal/add/nojs',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize-mode' => 'goals',
        'class' => array(
          'acquia-lift-goals-new',
          'visitor-actions-ui-ignore',
          'acquia-lift-menu-create',
          'acquia-lift-menu-link',
          'ctools-use-modal',
          'ctools-modal-acquia-lift-style',
          'overlay-exclude',
        ),
        'id' => 'acquia-lift-menu-goal-add',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 3,
    'plid' => $item_goal,
  );
  menu_link_save($item);

  // Create a link to targeting.
  $item = array(
    'link_title' => 'Who',
    'link_path' => 'admin/structure/personalize/manage/acquia-lift-placeholder/targeting',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize' => 'targeting',
        'class' => array(
          'visitor-actions-ui-ignore',
          'overlay-exclude',
        ),
        'id' => 'acquia-lift-menu-targeting',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 4,
  );
  menu_link_save($item);

  // Create a link for scheduling
  $item = array(
    'link_title' => 'When',
    'link_path' => 'admin/structure/personalize/manage/acquia-lift-placeholder/scheduling',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize' => 'scheduling',
        'class' => array(
          'visitor-actions-ui-ignore',
          'overlay-exclude',
        ),
        'id' => 'acquia-lift-menu-scheduling',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 5,
  );
  menu_link_save($item);

  // Create a link for review
  $item = array(
    'link_title' => 'Review',
    'link_path' => 'admin/structure/personalize/manage/acquia-lift-placeholder/review',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize' => 'review',
        'class' => array(
          'visitor-actions-ui-ignore',
          'overlay-exclude',
        ),
        'id' => 'acquia-lift-menu-review',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 6,
  );
  menu_link_save($item);

  // Create a link to the reports page.
  $item = array(
    'link_title' => 'Reports',
    'link_path' => 'admin/structure/personalize/manage/acquia-lift-placeholder/report',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize' => 'reports',
        'class' => array(
          'acquia-lift-results-list',
          'visitor-actions-ui-ignore',
        ),
        'id' => 'acquia-lift-menu-reports',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 20,
  );
  menu_link_save($item);

  // Update the menu router information.
  menu_rebuild();
}