home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (xmlsitemap_menu.install)

This example Drupal source code file (xmlsitemap_menu.install) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, array_keys, as, foreach, function, menu, menu_link, menus, php, settings, status, xmlsitemap, xmlsitemap_menu_update_6200, xmlsitemap_priority_default

The xmlsitemap_menu.install Drupal example source code

<?php
// $Id: xmlsitemap_menu.install,v 1.7 2011/02/09 22:08:58 davereid Exp $

/**
 * @file
 * Install and uninstall schema and functions for the xmlsitemap_menu module.
 */

/**
 * Implements hook_uninstall().
 */
function xmlsitemap_menu_uninstall() {
  drupal_load('module', 'menu');
  drupal_load('module', 'xmlsitemap');
  $menus = array_keys(menu_get_menus());
  foreach ($menus as $menu) {
    xmlsitemap_link_bundle_delete('menu_link', $menu);
  }
}

/**
 * Cleanup variables.
 */
function xmlsitemap_menu_update_6200() {
  drupal_load('module', 'menu');
  drupal_load('module', 'xmlsitemap');
  $menus = array_keys(menu_get_menus());
  foreach ($menus as $menu) {
    $settings = array(
      'status' => variable_get('xmlsitemap_menu_status_' . $menu, XMLSITEMAP_STATUS_DEFAULT),
      'priority' => variable_get('xmlsitemap_menu_priority_' . $menu, XMLSITEMAP_PRIORITY_DEFAULT),
    );
    variable_set('xmlsitemap_settings_menu_' . $menu, $settings);
    variable_del('xmlsitemap_menu_status_' . $menu);
    variable_del('xmlsitemap_menu_priority_' . $menu);
    variable_del('xmlsitemap_menu_calculate_priority_' . $menu);
  }
  variable_del('xmlsitemap_menu_menus');
  variable_del('xmlsitemap_menu_calculate_priority');
}

/**
 * Rename the menu type to 'menu_link'.
 */
function xmlsitemap_menu_update_6201() {
  drupal_load('module', 'xmlsitemap');
  xmlsitemap_link_type_rename('menu', 'menu_link');
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal xmlsitemap_menu.install source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.