[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/cck/modules/optionwidgets/ -> optionwidgets.install (source)

   1  <?php
   2  // $Id: optionwidgets.install,v 1.23.2.7 2008/10/04 13:14:22 karens Exp $
   3  
   4  /**
   5   * @file
   6   * Implementation of hook_install().
   7   */
   8  function optionwidgets_install() {
   9    drupal_load('module', 'content');
  10    content_notify('install', 'optionwidgets');
  11  }
  12  
  13  /**
  14   * Implementation of hook_uninstall().
  15   */
  16  function optionwidgets_uninstall() {
  17    drupal_load('module', 'content');
  18    content_notify('uninstall', 'optionwidgets');
  19  }
  20  
  21  /**
  22   * Implementation of hook_enable().
  23   *
  24   * Notify content module when this module is enabled.
  25   */
  26  function optionwidgets_enable() {
  27    drupal_load('module', 'content');
  28    content_notify('enable', 'optionwidgets');
  29  }
  30  
  31  /**
  32   * Implementation of hook_disable().
  33   *
  34   * Notify content module when this module is disabled.
  35   */
  36  function optionwidgets_disable() {
  37    drupal_load('module', 'content');
  38    content_notify('disable', 'optionwidgets');
  39  }
  40  
  41  function optionwidgets_update_last_removed() {
  42    return 1;
  43  }
  44  
  45  /**
  46   * Rename widgets from 'options_xxx' to 'optionwidgets_xxx' so hook_elements
  47   * and hook_themes items are prefixed with module name as they should be.
  48   *
  49   * The change in widget types will keep content_update_6000() from correctly updating
  50   * the module names in the field and instance tables, so do it here.
  51   */
  52  function optionwidgets_update_6000() {
  53    if ($abort = content_check_update('optionwidgets')) {
  54      return $abort;
  55    }
  56  
  57    $ret = array();
  58  
  59    drupal_load('module', 'content');
  60    $ret[] = update_sql("UPDATE {". content_instance_tablename() ."} SET widget_type = 'optionwidgets_select' WHERE widget_type = 'options_select'");
  61    $ret[] = update_sql("UPDATE {". content_instance_tablename() ."} SET widget_type = 'optionwidgets_onoff' WHERE widget_type = 'options_onoff'");
  62    $ret[] = update_sql("UPDATE {". content_instance_tablename() ."} SET widget_type = 'optionwidgets_buttons' WHERE widget_type = 'options_buttons'");
  63  
  64    content_associate_fields('optionwidgets');
  65    return $ret;
  66  }
  67  
  68  /**
  69   * Update 6000 was possibly broken if it was executed while
  70   * the modules were still disabled, so we re-run it.
  71   * Having it run a second time on sites that got updated correctly has no
  72   * side-effect (see http://drupal.org/node/310873).
  73   */
  74  function optionwidgets_update_6001() {
  75    return optionwidgets_update_6000();
  76  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7