From 8b1900b1bfea3a721c23733ff94c5d10b903a07b Mon Sep 17 00:00:00 2001
From: Chris Leppanen <chris.leppanen@gmail.com>
Date: Wed, 18 Apr 2012 10:10:46 -0700
Subject: [PATCH] Issue #1245094 by chrisdejager, dman: Fixed Node menu link
 deleted on update.

---
 plugins/FeedsNodeProcessor.inc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc
index b3636073..5aac2100 100644
--- a/plugins/FeedsNodeProcessor.inc
+++ b/plugins/FeedsNodeProcessor.inc
@@ -46,6 +46,8 @@ class FeedsNodeProcessor extends FeedsProcessor {
    *
    * If the update existing method is not FEEDS_UPDATE_EXISTING, only the node
    * table will be loaded, foregoing the node_load API for better performance.
+   *
+   * @todo Reevaluate the use of node_object_prepare().
    */
   protected function entityLoad(FeedsSource $source, $nid) {
     if ($this->config['update_existing'] == FEEDS_UPDATE_EXISTING) {
@@ -57,6 +59,14 @@ class FeedsNodeProcessor extends FeedsProcessor {
       $node->uid = $this->config['author'];
     }
     node_object_prepare($node);
+
+    // Workaround for issue #1247506. See #1245094 for backstory.
+    if (!empty($node->menu)) {
+      // If the node has a menu item(with a valid mlid) it must be flagged
+      // 'enabled'.
+      $node->menu['link']['enabled'] = (int) (bool) $node->menu['link']['mlid'];
+    }
+
     // Populate properties that are set by node_object_prepare().
     if ($this->config['update_existing'] == FEEDS_UPDATE_EXISTING) {
       $node->log = 'Updated by FeedsNodeProcessor';
-- 
GitLab