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

Drupal example source code file (admin_menu_toolbar.install)

This example Drupal source code file (admin_menu_toolbar.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

101, admin_menu_toolbar, and, db_query, execute, function, module, name, php, sql, system, type, weight, where

The admin_menu_toolbar.install Drupal example source code

<?php
// $Id: admin_menu_toolbar.install,v 1.2 2010/02/19 20:26:34 sun Exp $

/**
 * @file
 * Installation functionality for Administration menu toolbar module.
 */

/**
 * Implements hook_install().
 */
function admin_menu_toolbar_install() {
  // Required to load JS/CSS in hook_init() after admin_menu.
  db_update('system')
    ->fields(array('weight' => 101))
    ->condition('type', 'module')
    ->condition('name', 'admin_menu_toolbar')
    ->execute();
}

/**
 * Set module weight to a value higher than admin_menu.
 *
 * At this point, admin_menu should have a weight of 100. To account for
 * customized weights, we increase the weight relatively.
 *
 * @see admin_menu_toolbar_install()
 */
function admin_menu_toolbar_update_6300() {
  $weight = db_query("SELECT weight FROM {system} WHERE type = 'module' AND name = 'admin_menu'")->fetchField();
  $weight++;
  db_update('system')
    ->fields(array('weight' => $weight))
    ->condition('type', 'module')
    ->condition('name', 'admin_menu_toolbar')
    ->execute();
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal admin_menu_toolbar.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.