With the beta3 update the context_field on a content type refuses to save the context and clone an existing content. The problem appears related to commit: Issue #1369172 by jec006 + coder clean-up (http://drupalcode.org/project/context_field.git/commit/395ae02d0d820fb6f...).

Line 503 was changed from:

$context = context_load($item[$id]['context']); ($item singular)
to
$context = context_load($items[$id]['context']); ($items plural)

which makes sense because $item does not exist. Thus the $context type is not an array and skips the cloning of the default context. The introduction of this fix causes the is_array check for $context in line 504:

if (is_array($context)) {...

to fail and the new context does not get created.

Not sure the exact intent here but for now changing line 504 to:

if (is_array($context) || empty($context)) {

fixes the issue and the context is saved and clone correctly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alphageekboy’s picture

Please review as the attached patch fixes my specific use case, but may change the context_field modules intent.

Attaching patch to add the || empty($context) to line 504.

emptyvoid’s picture

Confirm, the default context is not cloned.. rather any new node modifying the default context.

tirdadc’s picture

Assigned: Unassigned » tirdadc
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.