Index: includes/module_builder.js =================================================================== RCS file: /cvs/drupal/contributions/modules/module_builder/includes/module_builder.js,v retrieving revision 1.2 diff -u -r1.2 module_builder.js --- includes/module_builder.js 4 Apr 2006 03:24:35 -0000 1.2 +++ includes/module_builder.js 10 Jan 2007 05:15:22 -0000 @@ -27,4 +27,4 @@ checkbox.checkCount += grouping.checked ? 1 : -1; checkbox.checked = checkbox.checkCount > 0; } -} \ No newline at end of file +} Index: includes/module_builder.css =================================================================== RCS file: /cvs/drupal/contributions/modules/module_builder/includes/module_builder.css,v retrieving revision 1.1 diff -u -r1.1 module_builder.css --- includes/module_builder.css 2 Apr 2006 22:51:15 -0000 1.1 +++ includes/module_builder.css 10 Jan 2007 05:15:22 -0000 @@ -15,4 +15,4 @@ width: 50%; margin: 0; padding: 0; -} \ No newline at end of file +} Index: templates/node_hooks.template =================================================================== RCS file: /cvs/drupal/contributions/modules/module_builder/templates/node_hooks.template,v retrieving revision 1.2 diff -u -r1.2 node_hooks.template --- templates/node_hooks.template 3 Apr 2006 05:04:42 -0000 1.2 +++ templates/node_hooks.template 10 Jan 2007 05:15:23 -0000 @@ -33,6 +33,7 @@ $items[] = array( 'path' => 'node/add/%module', 'title' => t('%name'), + 'description' => t('%description'), 'access' => user_access('create %name'), // OPTIONAL: Fill in other properties ); @@ -132,4 +133,4 @@ // $order_info = theme('node_example_order_info', $node); // $node->body .= $order_info; // $node->teaser .= $order_info; -== END == \ No newline at end of file +== END == Index: module_builder.module =================================================================== RCS file: /cvs/drupal/contributions/modules/module_builder/module_builder.module,v retrieving revision 1.27 diff -u -r1.27 module_builder.module --- module_builder.module 5 Apr 2006 04:13:13 -0000 1.27 +++ module_builder.module 10 Jan 2007 05:15:22 -0000 @@ -19,18 +19,6 @@ */ /** - * Implementation of hook_help(). - * - * @ingroup module_builder_core - */ -function module_builder_help($section) { - switch ($section) { - case 'admin/modules#description': - return t('Builds scaffolding for custom modules.'); - } -} - -/** * Implementation of hook_perm(). * * @ingroup module_builder_core @@ -50,13 +38,25 @@ if ($may_cache) { $items[] = array( 'path' => 'module_builder', - 'title' => t('module builder'), - 'callback' => 'module_builder_page', + 'title' => t('Module Builder'), + 'description' => t('Builds scaffolding for custom modules.'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('module_builder_page'), + 'access' => user_access('access module builder'), + 'type' => MENU_NORMAL_ITEM, + ); + $items[] = array( + 'path' => 'admin/settings/module_builder', + 'title' => t('Module Builder'), + 'description' => t('Configure Module Builder.'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('module_builder_admin_settings'), 'access' => user_access('access module builder'), + 'type' => MENU_NORMAL_ITEM, ); $items[] = array( 'path' => 'module_builder_process', - 'title' => t('module builder'), + 'title' => t('Module Builder'), 'callback' => 'module_builder_process', 'access' => user_access('access module builder'), 'type' => MENU_CALLBACK, @@ -71,15 +71,12 @@ * * @ingroup module_builder_core */ -function module_builder_settings() { - $op = $_POST['op']; - - _module_builder_check_settings(); +function module_builder_admin_settings() { $form['module_builder_hooks_directory'] = array( '#type' => 'textfield', '#title' => t('Path to hook documentation directory'), - '#description' => t('Subdirectory in the directory "%dir" where local copies of hook documentation should be stored.', array('%dir' => ''. variable_get('file_directory_path', 'files') .'/')), + '#description' => t('Subdirectory in the directory "%dir" where local copies of hook documentation should be stored.', array('%dir' => variable_get('file_directory_path', 'files') .'/')), '#default_value' => variable_get('module_builder_hooks_directory', 'hooks'), ); $form['module_builder_header'] = array( @@ -116,7 +113,7 @@ $form['module_builder_download'] = array( '#type' => 'radios', - '#title' => t('Download module file checkbox defaults to:'), + '#title' => t('Download module file checkbox defaults to'), '#description' => t('When checked, this will automatically generate your module file for you and prompt your browser to download it.'), '#options' => array( 1 => t('Enabled'), @@ -125,21 +122,21 @@ '#default_value' => variable_get('module_builder_download', 1), ); - if ($op == t('Update')) { + if ($_POST['op'] == t('Update')) { module_builder_update_documentation(); } $form['module_builder_update'] = array( '#type' => 'fieldset', '#title' => t('Update hook documentation'), - '#description' => t('Your last hook documentation update was %date.', array('%date' => ''. variable_get('module_builder_last_update', 0) .'')), + '#description' => t('Your last hook documentation update was %date.', array('%date' => variable_get('module_builder_last_update', 0))), ); $form['module_builder_update']['update'] = array( '#type' => 'button', '#value' => t('Update'), ); - return $form; + return system_settings_form($form); } /** @@ -173,8 +170,7 @@ _module_builder_check_settings(); // Include CSS for formatting - $path = drupal_get_path('module', 'module_builder'); - theme_add_style($path . '/includes/module_builder.css'); + drupal_add_css(drupal_get_path('module', 'module_builder') .'/includes/module_builder.css'); // Module properties $form['module_root_name'] = array( @@ -186,7 +182,7 @@ $form['module_short_description'] = array( '#type' => 'textfield', '#title' => t('Module short description'), - '#description' => t('Will appear in the module listing at administer >> modules.', array('%listing' => url('admin/modules'))), + '#description' => t('Will appear in the module listing at administer >> modules.', array('!listing' => url('admin/build/modules'))), '#required' => TRUE, ); $form['module_readable_name'] = array( @@ -197,16 +193,16 @@ $form['module_help_text'] = array( '#type' => 'textarea', '#title' => t('Help text'), - '#description' => t('Help text (HTML) to appear in administer >> help >> module_name page', array('%help' => url('admin/help'))), + '#description' => t('Help text (HTML) to appear in administer >> help >> module_name page', array('!help' => url('admin/help'))), ); // Check for custom hook_groups file, else use default - $path = drupal_get_path('module', 'module_builder') . '/templates'; + $path = drupal_get_path('module', 'module_builder'); if (file_exists("$path/hook_groups-custom.template")) { - $template_file = file_get_contents("$path/hook_groups-custom.template"); + $template_file = file_get_contents("$path/templates/hook_groups-custom.template"); } else { - $template_file = file_get_contents("$path/hook_groups.template"); + $template_file = file_get_contents("$path/templates/hook_groups.template"); } $form['hook_groups'] = array( @@ -215,7 +211,6 @@ '#description' => t('Selecting one or more of these features will automatically select appropriate hooks for you.'), ); - $path = drupal_get_path('module', 'module_builder'); drupal_add_js($path .'/includes/module_builder.js'); // Get list of hook groups @@ -249,7 +244,7 @@ $hook_groups = module_builder_get_hook_data(); if (!is_array($hook_groups) || !count($hook_groups)) { - form_set_error('hooks', t('No hooks were found. Please check the documentation path specified in the admininster >> settings >> modulebuilder page.', array('%settings' => url('admin/settings/module_builder')))); + form_set_error('hooks', t('No hooks were found. Please check the documentation path specified in the admininster >> settings >> modulebuilder page.', array('!settings' => url('admin/settings/module_builder')))); } else { @@ -311,7 +306,7 @@ ); } - return drupal_get_form('module_builder_page', $form); + return $form; } /** @@ -320,7 +315,7 @@ function theme_module_builder_hook_list($form) { $output = "
\n"; return $output; @@ -380,7 +375,7 @@ // Include link in breadcrumb to go back to main module builder form $breadcrumb = drupal_get_breadcrumb(); - $breadcrumb[] = l(t('module builder'), 'module_builder'); + $breadcrumb[] = l(t('Module Builder'), 'module_builder'); drupal_set_breadcrumb($breadcrumb); // Grab header from settings @@ -674,10 +669,9 @@ function module_builder_update_documentation() { // Retrieve remote hook file listing from cvs.drupal.org $hook_listing = drupal_http_request('http://cvs.drupal.org/viewcvs/drupal/contributions/docs/developer/hooks/?only_with_tag='. MODULE_BUILDER_VERSION); - if ($hook_listing->error) { + if (isset($hook_listing->error)) { return FALSE; } - $url_pattern = '!\ > modules. 3. Go to administer >> settings >> module_builder and specify the path to save the hook documentation files -4. The first time you visit the settings page or the module builder form, - the module will retrieve hook documentation from cvs.drupal.org and - store it locally. When you want to update this documentation later on, - return to the settings page and click the "Update" button. +4. The first time you visit the module builder form, the module will + retrieve hook documentation from cvs.drupal.org and store it locally. + When you want to update this documentation later on, return to the + settings page and click the "Update" button. 5. (Optional) Create custom function declaration template file(s) if you don't like the default output. 6. (Optional) Create your own hook groupings if you don't like the @@ -46,8 +46,9 @@ hooks individually. 4. Click the "Submit" button and watch your module's code generated before your eyes! ;) -5. Copy and paste the code into a file called .module and - save it in your modules directory. +5. Copy and paste the code into a files called .module, + .info and .install and save them to + a directory under one of the modules directories. 6. Start customizing it to your needs; most of the tedious work is already done for you! ;) Index: module_builder.info =================================================================== RCS file: module_builder.info diff -N module_builder.info --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module_builder.info 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,4 @@ +; $Id$ +name = Module Builder +description = Builds scaffolding for custom modules. +version = "$Name$"