Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Helper function to re-create a menu with links.
- *
- * @param array $links
- * List of links.
- *
- * @param array $menu
- * Menu data.
- */
- function _my_feature_links_menu($links, $menu) {
- $exists = db_query("SELECT title FROM {menu_custom} WHERE menu_name=:menu_name", array(':menu_name' => $menu['menu_name']))->fetchField();
- if (!$exists) {
- menu_save($menu);
- }
- $count = 0;
- foreach ($links as $title => $link) {
- $item = array(
- 'link_path' => $link,
- 'link_title' => $title,
- 'menu_name' => $menu['menu_name'],
- 'weight' => $count,
- );
- menu_link_save($item);
- $count++;
- }
- }
- /**
- * Number Ticket/Issue - description.
- */
- function my_feature_install() {
- $news_by_audience = menu_load('menu-news-by-audience');
- $news_utility = menu_load('menu-news-utility-menu');
- menu_delete($news_by_audience);
- menu_delete($news_utility);
- $links_news_by_audience = array(
- 'Students' => 'taxonomy/term/4202',
- 'Business & Industry' => 'taxonomy/term/4206',
- 'Alumni' => 'taxonomy/term/4204',
- 'Visitors & Neighbors' => 'taxonomy/term/4203',
- 'Faculty & Staff' => 'taxonomy/term/4205',
- );
- $links_news_utility = array(
- 'For the Media' => 'http://media.psu.edu/',
- 'Contact Us' => 'node/263941',
- 'Stay Connected' => 'node/142040',
- );
- _my_feature_links_menu($links_news_by_audience, $news_by_audience);
- _my_feature_links_menu($links_news_utility, $news_utility);
- features_revert(array('psu_news_header'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement