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