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 ?

CommentFileSizeAuthor
#8 webform_undefined_content-949378-8.patch927 bytesDas123

Comments

pingo’s picture

I get the same error message (on line 1456 though)... Any solutions?

benshell’s picture

This 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.

quicksketch’s picture

Priority: Major » Normal
Status: Active » Closed (duplicate)
wOOge’s picture

Status: Closed (duplicate) » Active

Switching 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:

stdClass Object
(
    [vid] => 4
    [uid] => 1
    [title] => Contact
    [log] => 
    [status] => 1
    [comment] => 0
    [promote] => 1
    [sticky] => 0
    [nid] => 4
    [type] => webform
    [language] => und
    [created] => 1310938511
    [changed] => 1311347563
    [tnid] => 0
    [translate] => 0
    [revision_timestamp] => 1311347563
    [revision_uid] => 1
    [body] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => 
contact us today:



                            [summary] => 
                            [format] => html
                            [safe_value] => 
contact us today:



                            [safe_summary] => 
                        )

                )

        )

    [webform] => Array
        (
            [nid] => 4
            [confirmation] => 
            [confirmation_format] => html
            [redirect_url] => 
            [status] => 1
            [block] => 1
            [teaser] => 0
            [allow_draft] => 0
            [auto_save] => 0
            [submit_notice] => 1
            [submit_text] => 
            [submit_limit] => -1
            [submit_interval] => -1
            [record_exists] => 1
            [roles] => Array
                (
                    [0] => 1
                    [1] => 2
                )

            [emails] => Array
                (
                )

            [components] => Array
                (
                )

        )

    [name] => Bob
    [picture] => 0
    [data] => b:0;
    [webform_block] => 1
wOOge’s picture

Status: Active » Closed (fixed)

Solved: The webform needs to have components, text boxes, email fields... at least one, to display, otherwise you get an error.

katebron’s picture

I'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"?

wOOge’s picture

@katebron

It means that if you have added a Webform as a block somewhere on your site, you may be experiencing this error.

Das123’s picture

Version: 7.x-3.4-beta1 » 7.x-3.17
Status: Closed (fixed) » Needs review
StatusFileSize
new927 bytes

Had 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.

akalata’s picture

Status: Needs review » Closed (fixed)

@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'].

TelFiRE’s picture

FYI, 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.

codemuncher’s picture

Not only that, but I can't even add a field. That version should be dev and/or beta.

Lanceken’s picture

FYI, 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.

kehogo’s picture

For 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:

module_invoke('webform', 'block_view', 'client-block-29');

Good luck out there!