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

Drupal example source code file (better_formats.install)

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

100, better_formats, better_formats_install, better_formats_uninstall, execute, function, like, php

The better_formats.install Drupal example source code

<?php

/**
 * @file
 * Installs the better_formats module.
 *
 * Creates a database for use of multi-layered default formats and sets
 * default settings.
 */

/**
 * Implements of hook_install().
 */
function better_formats_install() {
  // Increase module weight to prevent compatibility issues.
  /*
  $sql = "UPDATE {system}
          SET weight = 100
          WHERE name = 'better_formats'";
  db_query($sql);
  */
  db_update('system')
    ->fields(array('weight' => 100))
    ->condition('name', 'better_formats')
    ->execute();
}

/**
 * Implements of hook_uninstall().
 */
function better_formats_uninstall() {
  // Delete settings from varible table.
  /*
  $sql = "DELETE FROM {variable}
          WHERE name LIKE 'better_formats%'";
  db_query($sql);
  */
  db_delete('variable')
    ->condition('name', 'better_formats%', 'LIKE')
    ->execute();
}

/**
 * Update from 6.x-1.2 to 7.x-1.0.
 */
/*
function better_formats_update_7000() {

}
*/

Other Drupal examples (source code examples)

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