Media Mover 6.2x API changes

In an attempt to improve the workflow of Media Mover, I'm going through the process of refining the main API aspect. The main reason for this is to move away from the 4 step model (harvest, process, store and complete) to a chainable set of definable actions.

These are some notes to self as I'm going through the process, but feedback is of course appreciated

function hook_media_mover() {
  return array(
    '#name' => t('My Media Mover module description'),
    '#actions' => array(
      array(
        // give each action in your module a unique id 
        '#action' => 'operation_1',
        // give your action a description
        '#description' => t('Do something with a file!'),
        // harvesting files is a special case. You only need
        // this for actions that harvest files
        '#harvest' => true,
        // if your action has configuration options, 
        // give a function which returns a form array
        '#configuration' => 'my_form_array_function',
        // when your action runs, you need to specify a function to
        // act on the incoming file
        '#run' => 'my_action_run_function',
      ),
      array(
        '#action' => 'operation_2',
        '#description' => t('Something else'),
        '#configuration' => 'my_other _form_array',
        '#run' => 'my_other_action_run'
      ),
    ),
  );
}

What seems better about this is that it does away with the messy $op stuff and makes the process of defining a single component more integrated. Also, I think it's going to make my crazy form building process go the way of the dodo.

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.