You are here

function _acquia_lift_build_menu in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 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.

13 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 113
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' => 'Campaigns',
    '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 campaign',
    'link_path' => 'admin/structure/personalize/add/nojs',
    'menu_name' => $menu_name,
    'options' => array(
      'attributes' => array(
        'data-acquia-lift-personalize-mode' => 'campaign',
        'aria-role' => 'button',
        'aria-pressed' => 'false',
        'class' => array(
          'acquia-lift-campaign-new',
          'visitor-actions-ui-ignore',
          'ctools-use-modal',
          'ctools-modal-acquia-lift-style',
          '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 campaigns',
    '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' => 'Variation sets',
    'link_path' => 'admin/structure/personalize/variations',
    '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 to the all variation sets page.
  $item = array(
    'link_title' => 'All variation sets',
    'link_path' => 'admin/structure/personalize/variations',
    '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-option-set-all',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 9,
    'plid' => $item_cv,
  );
  menu_link_save($item);

  // Create a link for listing Goals.
  $item = array(
    'link_title' => 'Goals',
    'link_path' => 'admin/structure/personalize/goals',
    '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 the goals page.
  $item = array(
    'link_title' => 'All goals',
    'link_path' => 'admin/structure/personalize/goals',
    '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-goal-all',
      ),
      'html' => FALSE,
    ),
    'expanded' => 1,
    'weight' => 9,
    'plid' => $item_goal,
  );
  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(
        '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);

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

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