Closed (fixed)
Project:
Webform
Version:
7.x-3.17
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Oct 2010 at 08:24 UTC
Updated:
18 Apr 2013 at 02:33 UTC
Jump to comment: Most recent file
Just add a webform bloc
Notice: Undefined property: stdClass::$content dans webform_block_view() (ligne 1455 de ..\sites\all\modules\webform\webform.module).
The problem is below, components key is not set
//see webform_node_view($node, $view_mode), webform.module, line 1192
if (empty($node->webform['components']) || ($teaser && !$node->webform['teaser']) || empty($node->nid)) {
return;
}
a problem in node_load ?
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | webform_undefined_content-949378-8.patch | 927 bytes | Das123 |
Comments
Comment #1
pingo commentedI get the same error message (on line 1456 though)... Any solutions?
Comment #2
benshell commentedThis is related to a current Drupal 7 core issue, http://drupal.org/node/884948. The patch on this issue fixes this webform block problem. It has to do with the node types parameter being incorrect during the node load of the webform.
Comment #3
quicksketchLooks like #884948: The wrong $types parameter is sometimes passed in to hook_node_load() has fixed this issue as a side-effect.
Comment #4
wOOge commentedSwitching status — I am receiving a similar error, seems that $content is not being filled. I looked at what's being loaded into $node at that function, and the array $node->content does not exist.
The error I'm getting is:
Undefined property: stdClass::$content in webform_block_view() line 1592 of sites/all/modules/webform/webform.module
Here is a printout of $node, at around line 1592:
Comment #5
wOOge commentedSolved: The webform needs to have components, text boxes, email fields... at least one, to display, otherwise you get an error.
Comment #6
katebron commentedI've been struggling with this error message - it's occuring on every page but the front.
Could you explain what is meant by "just adding a webform block"?
Comment #7
wOOge commented@katebron
It means that if you have added a Webform as a block somewhere on your site, you may be experiencing this error.
Comment #8
Das123 commentedHad this error when implementing SimpleNews on line 1715. The error came about because $node->content didn't exist. All the patch does is wrap the $content var in an if statement to check if $node->content['webform'] is set. This works for us but there may be a better check that can be performed here.
Comment #9
akalata commented@Das123 I'm not sure if yours is the same issue, since this is about webforms in block rather than node display.
Leaving this as a quick note since it's related to webform_block_view:
After my upgrade to 7.x-3.17 I could no longer use $block['content']['#form'] and had to switch it to just $block['content'].
Comment #10
TelFiRE commentedFYI, a similar error occurs if you do not have any fields in your form! This may sound obvious, but it might save someone some time.
Comment #11
codemuncher commentedNot only that, but I can't even add a field. That version should be dev and/or beta.
Comment #12
Lanceken commentedFYI, I had the same problem. The patch didn't work. Caching views can give unexpected results. Removing cache on all the views resolved the problem for me.
Comment #13
kehogo commentedFor me, the problem was caused because I had a tpl file that was using a module invoke to get the block content, but the block had a different id (migrating from dev to live).
This code was causing the problem for me:
Good luck out there!