Revising Media Mover API

Doug Green is working on a CCK module for Media Mover and pointed out that there were a few ways that the API could be improved to make it easier for other developers.

For one, the way that configuration forms have been handled is a bit cumbersome. In order to keep data accessible, configuration forms needed to be named a particular way. Previously, $form["{$action_id}_data_name"] was used to keep data straight. Now, the Media Mover API will handle this task when the configuration forms are loaded, so developers are free to name their forms as $form['data_name']. Additionally, the top level fieldset of a configuration form has some class and id data appended to it so that they can be shown and hidden as the user makes different choices. This is the same functionality as was previously spec'd, however it is done automatically now.

To do this, I've changed the actions parameter to work slightly differently. Now, the actions parameter expects a nested array with a verb defining each action:


  $actions = array(
    'harvest' => array(
      'action_id' => t('My action name'),
      'action_id_2' => t('My second action name'),
    )
  );

Because of this, the verbs declaration is no longer needed as all the data is being fetched out of the actions array. It's also now possible to name the action_id parameters something a bit more intelligible, however these still should only contain alpha numeric characters.

Hopefully, this makes it easier for developers to write new modules and brings things more inline with how module developers are accustomed to writing Drupal code.

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