API Revision Round 2

UPDATED

After some consideration and discussion with Robin I think my first go at hook_media_mover is off the mark. Using hook_menu as the template, I think the process of defining media mover actions can be simplified:

function mm_node_media_mover() {
  $items = array();
  $items['set_node_status'] = array(
    'description' => t('Set node status'),
    'configuration' => 'mm_node_config_complete',
    'callback' => 'mm_node_complete',
  );
  return $items;
}

$items[NAME] identifies the specific action. The individual items for each action- description, configuration, callback, harvest provide information about what to do with this action.

  • description: describes the action
  • configuration: callback to a function that returns a form array. Expects: $step
  • callback: callback to a function that runs the actual action. Expects $step, $file
  • delete callback: (optional) when a file is being deleted, this function will be called. Expects $step, $file
  • update callback: (optional) update a file as it is being saved in the media mover process. Expects $step, $file
  • load callback: (optional) callback to a function that can add data to a file when it is loaded. Expects $step, $file
  • harvest: (optional) boolean, is this a harvesting action?

Technically, all of these items are optional, however, in a normal implementation, you will need description, configuration, and callback to integrate your function.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • 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> <blockquote> <code> <pre> <embed> <object> <b></div>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.