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.
Comment | File | Size | Author |
---|---|---|---|
#1 | context-does-not-save-on-form-1533482-1.patch | 782 bytes | alphageekboy |
Comments
Comment #1
alphageekboy CreditAttribution: alphageekboy commentedPlease 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.
Comment #2
emptyvoid CreditAttribution: emptyvoid commentedConfirm, the default context is not cloned.. rather any new node modifying the default context.
Comment #3
tirdadc CreditAttribution: tirdadc commentedCommitted: http://drupalcode.org/project/context_field.git/commitdiff/994d383