Formalize the Media Mover hook

I've been working over the weekend to finish up the media mover hook system. I think I've finally finished out the final form of the hook and the different options that are available. Here's a commented version of what I'm using in the media_mover.inc file

/**
 * Implementation of media_mover hook
 */
function media_mover_media_mover($op, $action = null, $config = null, &$file = array() ) {

  switch ($op) {

    // give your driver a name
    case 'name':
      return "Media Mover module";
    break;

    // create a new configuration option set
    // $type is used to ensure namespacing is kept consistent
    // in the form xname space.
    // returns a form array
    case 'new_config':
      switch($action){
      	case "harvest:select drupal uploaded files":
          return _media_mover_admin_harvest_config($action);
        break;
      }
    break;

    // set standard configuration for this module
    // displayed on admin/settings/media_mover
    // returns a form array
    case 'admin':
      return _media_mover_admin();
    break;

    // defines what type of driver this module is
    // array of harvest, process, storage
    case 'verbs':
      return array("harvest");
    break;

    // defines the name of what this module does
    // array of definitions
    case 'actions':
      return array("select drupal uploaded files");
    break;

    // defines directories (under master media_mover directory)
    // this module uses
    // array of directories, will be created under the default
    // media_mover directory, set in admin
    case 'directories':
    break;

    // allows for module to add additional data in a different db
    // add file to db action. called from media_mover's mm_files_db_add
    // by default, medial_mover's files table is used. $file is available
    case 'add':
    break;

    // allows for module to fetch additional data
    // add file to db action. called from media_mover's mm_files_db_fetch
    // by default, medial_mover's files table is used. $file is available
    case 'fetch':
    break;

    // allows for module to update additional critera
    // add file to db action. called from media_mover's mm_files_db_update
    // by default, medial_mover's files table is used. $file is available
    case 'update':
    break;

    // functions called on harvest op
    // returns an array of $files
    case 'harvest':
      return _mm_harvest();
    break;

    // functions called on process op
    case 'process':
    break;

    // functions called on storage op
    case 'storage':
    break;

    // custom theme a file assoicated with this module
    case 'theme':
    break;

    default:
      return;
    break;
  }
  return;
}

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options