# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: contributions/modules/context/context.core.inc
--- contributions/modules/context/context.core.inc Base (1.1.2.3.2.20.2.30)
+++ contributions/modules/context/context.core.inc Locally Modified (Based On 1.1.2.3.2.20.2.30)
@@ -171,6 +171,14 @@
       $plugin->execute($node, $op);
     }
   }
+  if (module_exists('content')) {
+    $content_type = content_types($node->type);
+    foreach ($content_type['fields'] as $field) {
+      if ($plugin = context_get_plugin('condition', $field['field_name'])) {
+        $plugin->execute($node, $op);
+      }
+    }
+  }
   if (module_exists('book')) {
     if ($plugin = context_get_plugin('condition', 'book')) {
       $plugin->execute($node, $op);
Index: contributions/modules/context/context.install
--- contributions/modules/context/context.install Base (1.1.2.1.2.6.2.11)
+++ contributions/modules/context/context.install Locally Modified (Based On 1.1.2.1.2.6.2.11)
@@ -309,6 +309,14 @@
         'views' => 'views',
         'nodequeue' => 'nodequeue'
       );
+      if (module_exists('content')) {
+        foreach (content_fields() as $field) {
+          $values = content_allowed_values($field);
+          if (!empty($values)) {
+            $conditions[$field['field_name']] = $field['field_name'];
+          }
+        }
+      }
       foreach ($conditions as $old_key => $new_key) {
         if (isset($context->{$old_key})) {
           $values = $context->{$old_key};
Index: contributions/modules/context/context.plugins.inc
--- contributions/modules/context/context.plugins.inc Base (1.1.2.9)
+++ contributions/modules/context/context.plugins.inc Locally Modified (Based On 1.1.2.9)
@@ -64,6 +64,18 @@
       'plugin' => 'context_condition_bookroot',
     );
   }
+  if (module_exists('content')) {
+    foreach (content_fields() as $field) {
+      $values = content_allowed_values($field);
+      if (!empty($values)) {
+        $registry['conditions'][$field['field_name']] = array(
+          'title' => t('Content: @field', array('@field' => $field['widget']['label'])),
+          'description' => t('Set this context when viewing a node with the selected value for the %label field', array('%label' => $field['field_name'])),
+          'plugin' => 'context_condition_content',
+        );
+      }
+    }
+  }
   if (module_exists('locale')) {
     $registry['conditions']['language'] = array(
       'title' => t('Language'),
@@ -209,6 +221,16 @@
       ),
     );
   }
+  if (module_exists('content')) {
+    $plugins['context_condition_content'] = array(
+      'handler' => array(
+        'path' => drupal_get_path('module', 'context') .'/plugins',
+        'file' => 'context_condition_content.inc',
+        'class' => 'context_condition_content',
+        'parent' => 'context_condition_node',
+      ),
+    );
+  }
   if (module_exists('book')) {
     $plugins['context_condition_book'] = array(
       'handler' => array(
Index: contributions/modules/context/plugins/context_condition_content.inc
--- contributions/modules/context/plugins/context_condition_content.inc No Base Revision
+++ contributions/modules/context/plugins/context_condition_content.inc Locally New
@@ -0,0 +1,41 @@
+<?php
+// $Id$
+
+/**
+ * Expose node content as a context condition.
+ */
+class context_condition_content extends context_condition_node {
+
+  function condition_values() {
+    $field = content_fields($this->plugin);
+    return content_allowed_values($field);
+  }
+
+  function execute($node, $op) {
+    $field = content_fields($this->plugin, $node->type);
+
+    // This plugin can only support one column fields.
+    $column = key($field['columns']);
+    if (is_array($node->{$this->plugin})) {
+      foreach ($node->{$this->plugin} as $item) {
+        // Do not check against undefined values
+        if (!$item[$column]) {
+          continue;
+        }
+        foreach ($this->get_contexts($item[$column]) as $context) {
+          // Check the node form option.
+          $options = $this->fetch_from_context($context, 'options');
+          if ($op === 'form') {
+            $options = $this->fetch_from_context($context, 'options');
+            if (!empty($options['node_form']) && in_array($options['node_form'], array(CONTEXT_NODE_FORM, CONTEXT_NODE_FORM_ONLY))) {
+              $this->condition_met($context, $item[$column]);
+            }
+          }
+          elseif (empty($options['node_form']) || $options['node_form'] != CONTEXT_NODE_FORM_ONLY) {
+            $this->condition_met($context, $item[$column]);
+          }
+        }
+      }
+    }
+  }
+}
