diff --git a/includes/rules.core.inc b/includes/rules.core.inc index 668cfa5..24d85c6 100644 --- a/includes/rules.core.inc +++ b/includes/rules.core.inc @@ -122,7 +122,7 @@ class RulesEntityController extends EntityAPIControllerExportable { // Create an empty configuration, re-set basic keys and import. $config = rules_plugin_factory($export['PLUGIN']); $config->name = $name; - foreach (array('label', 'active', 'weight', 'tags', 'access_exposed') as $key) { + foreach (array('label', 'active', 'weight', 'tags', 'access_exposed', 'owner') as $key) { if (isset($export[strtoupper($key)])) { $config->$key = $export[strtoupper($key)]; } @@ -1098,7 +1098,9 @@ abstract class RulesPlugin extends RulesExtendable { // @todo: For Drupal 8 use "owner" for generating machine names also and // module only for the modules providing default configurations. $this->module = !isset($this->module) || $module != 'rules' ? $module : $this->module; - $this->owner = !isset($this->owner) || $module != 'rules' ? $module : $this->module; + if (!isset($this->owner)) { + $this->owner = 'rules'; + } $this->ensureNameExists(); $this->data = $this; $return = entity_get_controller('rules_config')->save($this); @@ -1406,6 +1408,9 @@ abstract class RulesPlugin extends RulesExtendable { if (isset($this->active) && !$this->active) { $export_cfg[$this->name]['ACTIVE'] = FALSE; } + if (!empty($this->owner)) { + $export_cfg[$this->name]['OWNER'] = $this->owner; + } if (!empty($this->tags)) { $export_cfg[$this->name]['TAGS'] = $this->tags; } diff --git a/tests/rules_test.rules_defaults.inc b/tests/rules_test.rules_defaults.inc index c75bbf9..a2016f2 100644 --- a/tests/rules_test.rules_defaults.inc +++ b/tests/rules_test.rules_defaults.inc @@ -77,6 +77,7 @@ function _rules_export_get_test_export() { "PLUGIN" : "reaction rule", "WEIGHT" : "-1", "ACTIVE" : false, + "OWNER" : "rules", "TAGS" : [ "bar", "baz", "foo" ], "REQUIRES" : [ "rules", "comment" ], "ON" : { "comment_insert" : [] },