Need to add (in README.txt, delta.module maybe) documentation on defining a delta in code (via custom module) and also via Features export.

I can take care of this once I have the details straight in my own head. :)

Comments

John Pitcairn’s picture

Any update on this?

John Pitcairn’s picture

For anyone looking for this while it's not well documented, you implement the ctools plugin api to load an exported delta configuration. In a custom module:

file mymodule.module:

<?php
/**
 * Implements hook_ctools_plugin_api().
 */
function mymodule_ctools_plugin_api($module, $api) {
  if ($module == 'delta' && $api == 'delta') {
    return array('version' => '3');
  }
}

file mymodule_delta.delta.inc:

<?php
/**
 * Implements hook_delta_default_templates().
 */
function mymodule_delta_default_templates() {
  $export = array();

  // Paste the exported delta code here.
  // ...
  // End of exported delta code.
  $export[$delta->name] = $delta;

  // Repeat the previous 4 lines for additional delta configurations.

  return $export;
}

Enable your module, then visit the Delta admin page and click "revert" for each exported delta configuration.

John Pitcairn’s picture

Hmm ... if attempt to override the module-provided defaults by editing the config in the UI, I can't save the edited config:

The configuration options have been saved.

Error messageRecoverable fatal error: Argument 2 passed to delta_reduce() must be an array, null given, called in /Volumes/Opus Locus/Sites/_drupal7/sites/all/modules/contrib/delta/plugins/delta/delta_injection.inc on line 100 and defined in delta_reduce() (line 256 of /Volumes/Opus Locus/Sites/_drupal7/sites/all/modules/contrib/delta/delta.module).

The configuration options are not saved.

So I guess I am missing something in the module code above. Himerus?