/[drupal]/contributions/modules/linkimagefield/linkimagefield.install
ViewVC logotype

Diff of /contributions/modules/linkimagefield/linkimagefield.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2, Thu Nov 27 06:15:54 2008 UTC revision 1.3, Wed Jul 1 02:17:28 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id:$  // $Id$
3    /**
4      * @file
5      *
6      * linkimagefield install and update code
7      * @author John Young <john@codeandcreative.com>
8      */
9    
10  /**  /**
11   * Implementation of hook_install().   * Implementation of hook_install().
12   */   */
13  function linkimagefield_install() {  function linkimagefield_install() {
14      drupal_load('module', 'content');
15      content_notify('install', 'linkimagefield');
16  }  }
17    
   
18  /**  /**
19   * Data is now stored in per-field tables.   * Implementation of hook_uninstall().
20   */   */
21  function linkimagefield_update_1() {  function linkimagefield_uninstall() {
22    $ret = array();    drupal_load('module', 'content');
23      content_notify('uninstall', 'linkimagefield');
   include_once(drupal_get_path('module', 'content') .'/content.module');  
   include_once(drupal_get_path('module', 'content') .'/content_admin.inc');  
   
   
   
   $fields = content_fields();  
   
   foreach ($fields as $field) {  
     switch ($field['type']) {  
       case 'file':  
         $columns = array(  
           'list' => array('type' => 'int', 'not null' => TRUE, 'default' => '0'),  
         );  
         content_alter_db_field(array(), array(), $field, $columns);  
         break;  
     }  
   }  
   db_query('DELETE FROM {cache}');  
   return $ret;  
24  }  }
25    
   
   
   
   
26  /**  /**
27   * Schema change to enable alt and title tags.   * Implementation of hook_enable().
28   */   */
29    function linkimagefield_enable() {
30  function linkimagefield_update_2() {    drupal_load('module', 'content');
31    $ret = array();    content_notify('enable', 'linkimagefield');
   
   include_once(drupal_get_path('module', 'content') .'/content.module');  
   include_once(drupal_get_path('module', 'content') .'/content_admin.inc');  
   
   $fields = content_fields();  
   
   foreach ($fields as $field) {  
     switch ($field['type']) {  
       case 'linkimage':  
         $oldcolumns = array(  
           'fid' => array('type' => 'int', 'not null' => TRUE, 'default' => '0'),  
         );  
         $newcolumns = array(  
           'fid' => array('type' => 'int', 'not null' => TRUE, 'default' => '0'),  
           'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => "''", 'sortable' => TRUE),  
           'alt' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => "''", 'sortable' => TRUE),  
           'url' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => "''", 'sortable' => TRUE),  
         );  
         content_alter_db_field($field, $oldcolumns, $field, $newcolumns);  
         break;  
     }  
     drupal_set_message('altered: <br /><pre>'. print_r($field, true) .'</pre>');  
   }  
   
   
   db_query('DELETE FROM {cache}');  
   return $ret;  
32  }  }
33    
34    /**
35     * Implementation of hook_disable().
36     */
37    function linkimagefield_disable() {
38      drupal_load('module', 'content');
39      content_notify('disable', 'linkimagefield');
40    }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.2