diff --git a/profiles/wcm_base/CHANGELOG.txt b/profiles/wcm_base/CHANGELOG.txt index 17fcc2d75d98b63534bbd7268bf152edf4ea1079..dad9e8575935adf5cc6cb7b15eff77488e6b4342 100644 --- a/profiles/wcm_base/CHANGELOG.txt +++ b/profiles/wcm_base/CHANGELOG.txt @@ -2,6 +2,7 @@ WCM Base 7.x-1.x, 2016-03-17 ---------------------------- - OCIO SimpleSAMLphp Auth: Added patch to fix missing email address when accounts are auto-provisioned. +- WCM Workbench: Patched Workbench Moderation to play nice with node export. WCM Base 7.x-1.x, 2016-03-15 ---------------------------- diff --git a/profiles/wcm_base/modules/contrib/workbench_moderation/PATCHES.txt b/profiles/wcm_base/modules/contrib/workbench_moderation/PATCHES.txt index b468405ce94fd0a20c60d42ccc1a27f6e4f0c483..eb6e306e14ed5e8d1f453b50729274ae358bd586 100644 --- a/profiles/wcm_base/modules/contrib/workbench_moderation/PATCHES.txt +++ b/profiles/wcm_base/modules/contrib/workbench_moderation/PATCHES.txt @@ -1,4 +1,5 @@ The following patches have been applied to this project: +- http://drupal.org/files/issues/node_export-2176841-4.patch - http://drupal.org/files/playnicewithpanels-1285090-22.patch - http://drupal.org/files/issues/view_all_unpublished-1492118-64.patch diff --git a/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.module b/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.module index fb6f0b33b60535a5714f2aeb006163a6e850c129..ef69e30a13bc9945b38b778bf93a3070454ebec9 100644 --- a/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.module +++ b/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.module @@ -2510,6 +2510,53 @@ function workbench_moderation_node_export_node_import_alter(&$node, $original_no $node->revision = 1; } +/** + * Implements hook_node_export_node_alter(). + * + * Manipulate a node on export. + * + * @param &$node + * The node to alter. + * @param $original_node + * The unaltered node. + */ +function workbench_moderation_node_export_node_alter(&$node, $original_node) { + + // Don't proceed if moderation is not enabled on this content type + if (!workbench_moderation_node_type_moderated($node->type)) { + return; + } + + //Set the current state to be the same as the current revision's state. + if(!isset($node->workbench_moderation_state_current) && isset($node->workbench_moderation) && isset($node->workbench_moderation['current'])){ + $node->workbench_moderation_state_current = $node->workbench_moderation['current']->state; + } + + // Set default moderation state values if they are not set. + if (!isset($node->workbench_moderation_state_current)) { + $node->workbench_moderation_state_current = ($node->status ? workbench_moderation_state_published() : workbench_moderation_state_none()); + }; + + if (isset($node->workbench_moderation_state_current)) { + // Set the new state to be the same as the current. + $node->workbench_moderation_state_new = $node->workbench_moderation_state_current; + } + + //Node revisions will not be exported so remove moderation states tied to revisions + unset($node->workbench_moderation); +} + +/** + * Implements hook_node_export_node_import_alter(). + */ +function workbench_moderation_node_export_node_import_alter(&$node, $original_node, $save) { + // Don't proceed if moderation is not enabled on this content type + if (!workbench_moderation_node_type_moderated($node->type)) { + return; + } + $node->revision = 1; +} + /** * Implements hook_ctools_plugin_pre_alter(). * diff --git a/profiles/wcm_base/modules/custom/wcm_workbench/wcm_workbench.make b/profiles/wcm_base/modules/custom/wcm_workbench/wcm_workbench.make index 293569819d00e398c26d9e90e3674f1c64fdbd74..e4c4c9ad9f950002f740a022cc75e118b4ba23cb 100644 --- a/profiles/wcm_base/modules/custom/wcm_workbench/wcm_workbench.make +++ b/profiles/wcm_base/modules/custom/wcm_workbench/wcm_workbench.make @@ -23,5 +23,6 @@ projects[workbench_moderation][subdir] = contrib projects[workbench_moderation][type] = module projects[workbench_moderation][download][type] = git projects[workbench_moderation][download][branch] = 7.x-1.x +projects[workbench_moderation][patch][2176841] = http://drupal.org/files/issues/node_export-2176841-4.patch projects[workbench_moderation][patch][2098151] = http://drupal.org/files/playnicewithpanels-1285090-22.patch projects[workbench_moderation][patch][1492118] = http://drupal.org/files/issues/view_all_unpublished-1492118-64.patch