From 3d6e2693ff593d94eb8b7080eb3d62223f9423cd Mon Sep 17 00:00:00 2001 From: Chris Gross <gross.364@osu.edu> Date: Thu, 17 Mar 2016 20:13:14 -0400 Subject: [PATCH] daily build 2 --- profiles/wcm_base/CHANGELOG.txt | 1 + .../contrib/workbench_moderation/PATCHES.txt | 1 + .../workbench_moderation.module | 47 +++++++++++++++++++ .../custom/wcm_workbench/wcm_workbench.make | 1 + 4 files changed, 50 insertions(+) diff --git a/profiles/wcm_base/CHANGELOG.txt b/profiles/wcm_base/CHANGELOG.txt index 17fcc2d7..dad9e857 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 b468405c..eb6e306e 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 fb6f0b33..ef69e30a 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 29356981..e4c4c9ad 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 -- GitLab