[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/module_builder/ -> module_builder.module_builder.inc (source)

   1  <?php
   2  
   3  /**
   4   * Implementation of hook_module_builder_info().
   5   *
   6   * Provide information about hook definition files to Module builder.
   7   *
   8   * On D6, define where hook definition files may be downloaded from and specify
   9   * the destination for their hooks. Only files defined here will be processed.
  10   *
  11   * On D7, specify the destination files for hooks that do not go in the default
  12   * %module.module file. All module.api.php files will be processed; this hook
  13   * merely provides extra information.
  14   *
  15   * This hook should go in a MODULE.module_builder.inc file in your module folder.
  16   * Is it only loaded by Module builder when the user goes to get new hook data.
  17   *
  18   * This hook serves a fairly different purpose on D7 compared to prior versions.
  19   * The same hook name is kept in case some awkward contrib modules continue to keep their hook definitions on a
  20   * remote server. There's a reason, honest!
  21   * The keys are different so here we spludge both together so this code
  22   * can run on any version with Drush.
  23   * Other modules implementing this shouldn't do this, as Module Builder invokes
  24   * and builds for the version of the current site.
  25   *
  26   * @return
  27   *   An array of data, keyed by module name.
  28   *   On D6, the subsequent array should specify:
  29   *    - url: a general url to fetch files from.
  30   *      Use tokens to insert filenames and branch: %file, %branch 
  31   *    - branch: the current branch of the module, eg DRUPAL-6--1, HEAD.
  32   *      TODO: find a neat way to grab this with a CVS id token?
  33   *    - group: the UI group these hooks should go in. This should probably be the
  34   *      name of your module, but you can use '#filenames' to specify that each
  35   *      of your files should form a group.
  36   *      Eg 'core.php' goes in the group 'core'.
  37   *    - hook_files: an array of files to fetch. The filename is the key
  38   *      and the value is the file where the hook code should eventually be stored.
  39   *      Usually this will be '%module.module' but for instance,
  40   *      'install.php' has hooks that should go in '%module.install'.
  41   *   On D7, the subsequent array should specify one or both of:
  42   *    - 'destination': the destination file for a hook's implementation, 
  43   *      eg '%module.module', '%module.views.inc'. This applies to all hooks in 
  44   *      the named file, unless:
  45   *    - 'hook_destinations': override destination for specific hooks here. This 
  46   *      is an array whose keys are destination strings, and values are themselves
  47   *      flat arrays of full hook names. Eg:
  48   *      '%module.install' => array(hook_install)
  49   */
  50  function module_builder_module_builder_info() {
  51    // Versions 5 and 6.
  52    $data['common'] = array(
  53      // Hooks on behalf of Drupal core.
  54      'system' => array(
  55        'url' => 'http://drupalcode.org/project/documentation.git/blob_plain/refs/heads/%branch:/developer/hooks/%file',
  56        'branch' => '6.x-1.x',
  57        'group' => '#filenames',
  58        'hook_files' => array(
  59          // List of files we should slurp from the url for hook defs.
  60          // and the destination file for processed code.
  61          'core.php' =>    '%module.module',
  62          'node.php' =>    '%module.module',      
  63          'install.php' => '%module.install',      
  64        ),
  65      ),
  66      // We need to do our own stuff now we have a hook!
  67      'module_builder' => array(
  68        'url' => 'http://drupalcode.org/project/module_builder.git/blob_plain/refs/heads/%branch:/hooks/%file',
  69        'branch' => '6.x-2.x',
  70        'group' => 'module builder',      
  71        'hook_files' => array(
  72          'module_builder.php' => '%module.module_builder.inc',
  73        ),
  74      ),
  75      
  76      // Support for some contrib modules (the ones I use ;) -- for more please
  77      // file a patch either here or with the module in question.
  78      // Views
  79      'views' => array(
  80        'url' => 'http://drupalcode.org/project/views.git/blob_plain/refs/heads/%branch:/docs/%file',
  81        // Probably should follow master as that may go away
  82        'branch' => 'master',
  83        'group' => 'views',      
  84        'hook_files' => array(
  85          'docs.php' => '%module.module',
  86          // other files here: view.inc, views.default.inc
  87        ),
  88        // hooks that go in files other than %module.module
  89        'hook_destinations' => array(
  90          '%module.views.inc' => array(
  91            'hook_views_data',
  92            'hook_views_data_alter',
  93            'hook_views_admin_links_alter',
  94            'hook_views_handlers',
  95            'hook_views_plugins',
  96            'hook_views_preview_info_alter',
  97            'hook_views_query_alter',
  98          ),
  99          '%module.views_convert.inc' => array(
 100            'hook_views_convert',
 101          ),
 102          '%module.views_default.inc' => array(
 103            'hook_views_default_views',
 104          ),
 105        ),
 106      ),
 107      // Ubercart
 108      'ubercart' => array(
 109        'url' => 'http://drupalcode.org/project/ubercart.git/blob_plain/refs/heads/%branch:/docs/%file',
 110        'branch' => '6.x-2.x',
 111        'group' => 'ubercart',      
 112        'hook_files' => array(
 113          'hooks.php' => '%module.module',
 114        ),
 115      ),
 116      // Signup
 117      'signup' => array(
 118        'url' => 'http://drupalcode.org/project/signup.git/blob_plain/refs/heads/%branch:/%file',
 119        'branch' => '6.x-2.x',
 120        'group' => 'signup',      
 121        'hook_files' => array(
 122          'signup.api.php' => '%module.module',
 123        ),
 124      ),
 125      // Ctools
 126      'ctools' => array(
 127        'url' => 'http://drupalcode.org/project/ctools.git/blob_plain/refs/heads/%branch:/%file',
 128        'branch' => '6.x-1.x',
 129        'group' => 'ctools',
 130        'hook_files' => array(
 131          'ctools.api.php' => '%module.module',
 132        ),
 133      ),
 134      // Webform
 135      'webform' => array(
 136        'url' => 'http://drupalcode.org/project/webform.git/blob_plain/refs/heads/%branch:/%file',
 137        'branch' => '6.x-3.x',
 138        'group' => 'webform',
 139        'hook_files' => array(
 140          'webform_hooks.php' => '%module.module',
 141        ),
 142      ),
 143    );
 144  
 145    // For D7, keys should match the filename MODULE.api.php
 146    $data['7'] = array(
 147      // Hooks on behalf of Drupal core.
 148      'system' => array(
 149        'hook_destinations' => array(
 150          '%module.install' => array(
 151            'hook_requirements',
 152            'hook_schema',
 153            'hook_schema_alter',
 154            'hook_install',
 155            'hook_update_N',
 156            'hook_update_last_removed',
 157            'hook_uninstall',
 158            'hook_enable',
 159            'hook_disable',
 160          ),     
 161        ),
 162      ),
 163    );
 164  
 165    // Return the data for the current version.
 166    $version = _module_builder_drupal_major_version();
 167    if (isset($data[$version])) {
 168      return $data[$version];
 169    }
 170    else {
 171      return $data['common'];
 172    }
 173  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7