Module Development

Creating your own custom modules isn't difficult in FlightPath.

Developers who have worked within Drupal 6 or Drupal 7 should feel right at home, as much of this process was greatly influenced by the Drupal project.

The first step is to select a name for your module.  It should be all lower-case, containing only letters, numbers, and underscores (_).  Let's say we chose the module name my_helper_module.

  • The first step would be to create a new folder under /custom/modules named my_custom_helper.
  • Next, create a file within that directory named my_custom_helper.info
    • It is a simple text file, which FP will read to determine more information about your module.
      Example:
      • name = enter a name here
        description = enter any description
        core = 6.x
    • You can also optionally enter a "version = 123" string.  If submitting your module to this site, do not enter a version, it will be added for you.
    • Other items you can add to your .info file:
      • required - set to "true" if this module cannot be disabled by any user.  For example, this is used with the core system module.
        • ex:  required = true
      • requires - a comma-separated list of modules your module requires.  This will cause the module to give a visual warning to the user about the other required modules on the "modules" page.  For example, see announcements module's .info file.
        • ex:  requires = content, stats, course_search
        • or:  requires = content
      • schema - An integer describing the "version" of any database tables your module creates.  This is only used during updates to your module, so that you the developer can tell when you are updating from an old version to a new version, and you need to make changes to your database tables. See hook_update in the api for more information.
      • requires core version - If this module requires that the user is running a certain version of FlightPath (or higher), it may be entered here.  For example, requires core version = 6.1.1
  • Next, create your actual PHP file.  It should be named my_custom_helper.module
    • Your module should have an opening <?php tag at the very top, but no closing ?> tag!
      Example:
      • <?php
        /**
        * Implementation of hook_init()
        **/
        function my_custom_helper_init() {
            fp_add_message("Hello World!");
        }
  • After this, you may now enable your module by visiting Admin -> Modules, and enabling it in the Custom section of that page.
  • Once enabled, you should see the "Hello World" message on every page load.