I am betting the answer is yes if one implements the proper ctools exportable hooks and returns (or alters) the proper object. I am just not sure how to do this.

For example, I experimented with the below code snippet which resulted in the following error "warning: Attempt to assign property of non-object in .../sites/all/modules/contrib/ctools/includes/export.inc on line 554."

function mymodule_ctools_plugin_api($module, $api) {
  if ($module == 'strongarm') {
    return array('version' => 1);
  }
}

/**
 * Implementation of hook_strongarm().
 */
function mymodule_strongarm() {
  return array('site_name' => 'My website');
}

Currently, most module related data on my existing website (including views, panels, imagecache, etc..) is being exported to code using pretty well documented techniques. I am just not 100% ready to move to the Features paradigm.

Thanks,
~jake

Comments

yhahn’s picture

Status: Active » Fixed

If you turn on the CTools Bulk Export module it will provide a simple form for selecting and exporting CTools exportable components.

jrockowitz’s picture

yhahn,

Thank you for your quick response. You saved me a lot of frustration... I was staring at so much code that I forgot about the bulk exporter.

Just in case someone else makes the same mistake, below are the code tweaks I needed to make to my hook_strongarm() implementation so that my variables array would be returned as an array of ctools compatible object.

Strongarm 1.x

function mymodule_strongarm() {
  return array('site_name' => 'My website');
}

Strongarm 2.x

function mymodule_ctools_plugin_api($module, $api) {
  if ($module == 'strongarm' && $api == 'strongarm') {
    return array('version' => 1);
  }
}

function mymodule_strongarm() {
  $variables = array('site_name' => 'My website');

  $strongarms = array();
  foreach ($variables as $name => $value) {
    $strongarm = new stdClass;
    $strongarm->api_version = 1;
    $strongarm->name = $name;
    $strongarm->value = $value;
    $strongarms[$name] = $strongarm;
  }

  return $strongarms;
}

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.