The ctools_context_get_defaults()
function uses $id
, $object
, and $subtype
variables, but neither defines them, nor receives them as function arguments.
Investigation of the $plugin
array defined in plugins/contexts/entity.inc
implies that $id
may possibly be intended refer to an optional $plugin_definition['defaults']['id']
value.
Searching for "subtype"
through ctools code reveals that it is always a separately defined variable, retrieved from code or $form_state
, and neither ctools_context_get_defaults()
nor its only caller, ctools_context_ajax_item_add()
, provide any clue as to how the $subtype
information could be retrieved.
The patch in #7 corrects the undefined variable references, and also simplifies the remaining function code.
Comments
Comment #1
sonar_un CreditAttribution: sonar_un commentedThanks for attempting to fix this issue, however I am running into this same problem as well. Unfortunately, with your patch I get other errors.
ResponseText: Notice: Undefined variable: conf in ctools_context_get_defaults() (line 619 of /includes/context-admin.inc).
Comment #2
pillarsdotnet CreditAttribution: pillarsdotnet commentedBetter patch, I hope. This could *really* use some review from the ctools maintainers, as I'm not at all sure of the correctness.
Comment #3
pillarsdotnet CreditAttribution: pillarsdotnet commentedThis one avoids unnecessarily renaming
$plugin_definition
to$plugin
.Comment #4
sonar_un CreditAttribution: sonar_un commentedUnfortunately, I ran into some more issues with patch #3.
ResponseText: Notice: Undefined variable: object in ctools_context_get_defaults() (line 620 of /includes/context-admin.inc).
Comment #5
pillarsdotnet CreditAttribution: pillarsdotnet commentedUpdated. Could really use review from OG developers, though.
Comment #5.0
pillarsdotnet CreditAttribution: pillarsdotnet commentedCorrected according to patch in #3
Comment #6
sonar_un CreditAttribution: sonar_un commentedWow, I know this is pretty difficult, maybe I am doing something strange here, but after your latest patch, I have yet another issue.
ResponseText: Notice: Undefined index: position in ctools_edit_context_form_defaults() (line 652 of /includes/context-admin.inc).
This is terrible for me because I can't add any contexts to panels because of this problem. I hope we can have a developer review this patch.
Thanks for all your help pillarsdotnet.
Comment #7
pillarsdotnet CreditAttribution: pillarsdotnet commentedUpdated again.
Comment #8
sonar_un CreditAttribution: sonar_un commented@pillarsdotnet - Patch #7 was able to get through the initial error, but now there are more when actually adding the context.
ResponseText: Notice: Undefined index: #parents in form_builder() (line 1738 of /includes/form.inc).
I tried this with multiple contexts and the issue was the same.
Comment #9
samhassell CreditAttribution: samhassell commentedThis is somewhat related to http://drupal.org/node/1014866, or more specifically http://drupal.org/files/issues/ctools-context-admin-form-definition_0.patch
Comment #9.0
pillarsdotnet CreditAttribution: pillarsdotnet commentedThe $object variable is also undefined.
Comment #10
pillarsdotnet CreditAttribution: pillarsdotnet commented@samhassell: I'm not sure whether #9 is in response to #8 or to the patch in #7. Can you please explain?
EDIT: I think I see. Some of the bugs fixed by this issue were introduced by the other.
Cross-referenced in #1014866-10: Collection of small bugfixes to get ctools working properly with panels
Comment #11
olegsmirnov CreditAttribution: olegsmirnov commentedafter patch #7 error message has disappeared, but context doesn't work till now (mini-panels)..
Comment #12
andypostsubscribe
Comment #13
thsutton CreditAttribution: thsutton commentedsubscribe
Comment #14
merlinofchaos CreditAttribution: merlinofchaos commentedThere was a lot more going on here than just a notice. The missing $id and other missing variables caused code that was designed to help you name your contexts was completely failing. I should've dug more into that; I had noticed the code wasn't working but I had never investigated. I should have.
Anyway, I committed a proper fix. Should take care of the notices as well, but in this case, the notice actually indicated a bug.
What's odd is that for some reason, I can't make notices appear when inside the modal. They appear just fine in normal use, but they do not appear in the modal. i don't know why.
Comment #15.0
(not verified) CreditAttribution: commentedUpdated patch reference.
Comment #16
xjm