[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/filefield_sources/ -> filefield_sources.install (source)

   1  <?php
   2  // $Id: filefield_sources.install,v 1.1 2010/02/21 13:37:28 quicksketch Exp $
   3  
   4  /**
   5   * @file
   6   * Update and install functions for FileField Sources.
   7   */
   8  
   9  /**
  10   * Implementation of hook_install().
  11   */
  12  function filefield_sources_install() {
  13    // FileField Sources needs to load after both ImageField and FileField.
  14    db_query("UPDATE {system} SET weight = 5 WHERE type = 'module' AND name = 'filefield_sources'");
  15  }
  16  
  17  /**
  18   * Enable FileField Sources on all current fields (as was the previous default).
  19   */
  20  function filefield_sources_update_6001() {
  21    $ret = array();
  22  
  23    drupal_load('module', 'content');
  24    module_load_include('inc', 'content', 'includes/content.crud');
  25  
  26    foreach (content_fields() as $field) {
  27      foreach (node_get_types('types') as $node_type => $type_info) {
  28        if ($type_field = content_fields($field['field_name'], $node_type)) {
  29          $type_field['widget']['filefield_sources'] = array(
  30            'imce' => 'imce',
  31            'reference' => 'reference',
  32            'remote' => 'remote',
  33          );
  34          content_field_instance_update($type_field);
  35        }
  36      }
  37    }
  38  
  39    // FileField Sources needs to load after both ImageField and FileField.
  40    $ret[] = update_sql("UPDATE {system} SET weight = 5 WHERE type = 'module' AND name = 'filefield_sources'");
  41  
  42    return $ret;
  43  }


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