Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
this is the notice message i am getting when ever i add taxanomy term or picture and few other fields ,
am using Panels->Pages->node_edit to reneder this content type.
Notice: Undefined property: stdClass::$nid in ctools_node_created_content_type_render() (line 35 of /var/www/html/dev1/sites/all/modules/ctools/plugins/content_types/node_context/node_created.inc).
wat can i do about this?
Comment | File | Size | Author |
---|---|---|---|
#15 | undefined_property_nid-1596720-node_content.patch | 593 bytes | beerbomber |
#4 | undefined_property_nid-1596720-4.patch | 585 bytes | joel_osc |
Comments
Comment #1
swentel CreditAttribution: swentel commentedIt looks like you are trying to add *display* fields on an *edit* form. Try using node_view if you want to try rendering a node. This won't at all especially if there's no node yet, so there's a slight chance this is not possible at all (which would make sense though)
Comment #2
mgiffordI just got this related error:
Notice: Undefined property: stdClass::$nid in ctools_node_updated_content_type_render() (line 34 of /DRUPAL7/sites/all/modules/contrib/ctools/plugins/content_types/node_context/node_updated.inc).
Comment #3
joel_osc CreditAttribution: joel_osc commentedJust to ellaborate on the above comment...we are seeing this error on a node/add form when selecting a value from a hiearchical select widget on an entity reference (taxonomy) field which uses AJAX to update the form. Since we are on a node/add form and have not yet submitted the node, I am not sure we should be in this code at all? If we should be then we should likely check $node->nid is set before using it on line 34.
I guess one possible solution would be to see if the $context->data->nid is set as well at line 23:
23 if (empty($context) || empty($context->data) || empty($context->data->nid)) {
Although, there is likely a better way to see if the form has been submitted.
Comment #4
joel_osc CreditAttribution: joel_osc commentedHere is a one line patch file if anyone needs it.
Comment #4.0
joel_osc CreditAttribution: joel_osc commentedNotice: Undefined property: stdClass::$nid in ctools_node_created_content_type_render() (line 35 of /var/www/html/dev1/sites/all/modules/ctools/plugins/content_types/node_context/node_created.inc).
Comment #5
DamienMcKennaYou should only assign an issue to yourself if you're going to work on it, otherwise please leave it unassigned. Thanks :)
Comment #7
mgiffordThis seem like a pretty simple one line patch. It still applies, but it's been sitting here for over 2 years now.
Can we get this into the repo and fix issue? Still applies nicely but I haven't got a local environment set up now to replicate the problem.
Comment #8
DamienMcKennaRTBC.
Comment #9
japerryQuick simple fix. Committed.
Comment #11
mgiffordThanks @DamienMcKenna & @japerry
Comment #13
beerbomber CreditAttribution: beerbomber commentedI am wondering why the patch was only applied and committed for node_update.inc
Seems like someone else encountered it with node_create.inc
And myself, have seen it with node_content.inc and I applied the same patch but to the function impacting me (ctools_node_content_content_type_render) and it works now.
Looking at node_update, node_create and node_content .inc they all assume that nid is not empty coming in the function.
Comment #14
beerbomber CreditAttribution: beerbomber commentedI updated to 7.x-1.10 (Aug-17-2016) and I noticed that I was getting Notice: Undefined property: stdClass::$nid in ctools_node_created_content_type_render() again.
To fix it, I had to reapply this to line 30 of node_content.inc because I have the same exact scenario explained at #3
function ctools_node_content_content_type_render($subtype, $conf, $panel_args, $context) {
if (!empty($context) && ( empty($context->data) || empty($context->data->nid)) ){
return;
}
I have never contributed a patch or else, where can I find the instruction so that I will suggest a patch ?
Comment #15
beerbomber CreditAttribution: beerbomber commented