Guys,

great module. each version is even better and the support from other developers is getting even higher.

Now to the point: some modules create node types. Features do not allow to save it nor save its custom CCK fields that we create over the default node type. So Image/Video nodes, eCommerce products and other hardcoded node types will not retain this modifications.

Solutions:
1* Or make a CCK group to select specific CCK fields from nodes (which also might help developers to not export developing/testing fields)
2* Or let Features also save existing node types (and making the module weight low to be overwritten by the original module), saving everything else (like CCK fields and other node settings) just like any other node type

best regards,

massa

Comments

yhahn’s picture

Unfortunately we cannot do #2 because of the way hook_node_info() is called -- module_invoke_all() does not overwrite existing keys but merges the returned arrays in a mess.

It turns out that Features is capable of exporting CCK fields into a feature without exporting the content type those fields are attached to. There is no UI exposure of this capability, but you can do this by adding lines like this to the info file of your feature module and running drush features-update:

features[content][] = "profile-field_profile_firstname"
features[content][] = "profile-field_profile_lastname"

This would add, for example, first name and lastname fields on the profile content type to your feature, even if your feature doesn't provide the profile content type itself.

I'd love to get your feedback on using this functionality before we go ahead and, say, expose it in the UI.

brmassa’s picture

young,

we could implement hack: re-scan the node list and then only include new node types if its not present before:

function myfeature_node_info() {
  $items = array(
    ...
  );

  static $rerun = TRUE;
  if ($rerun) {
    $rerun = FALSE;
    $node_types = module_invoke_all('node_info');
    foreach (array_keys($node_types) as $node_type) {
      unset($items[$node_type]);
    }
    $rerun = TRUE;
    return $items;
  }
  return;
}

this can make sure that it will save everything that we currently support (not only CCK fields, but other info that in the future Features could handle) and disable in case the original module shows up.

regards,

massa

brmassa’s picture

Young,

and about your solution of modifying the .info and run a update, it works perfectly. The Ui can be implemented like the current menu/menu-links export: they are independent to each other.

best regards,

massa

yhahn’s picture

Title: CCK fields from hardcoded node type » CCK fields UI export options
Assigned: Unassigned » yhahn
Category: feature » task

Sounds good, I'll opt out on the hack (rather ugly, don't you think?) and go with adding UI options for distinct fields.

yhahn’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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