I've got an issue that might be related to http://drupal.org/node/833730
- contenttype A containing a field B with cck_block enabled, cck text field C
- i use http://drupal.org/project/node_embed to embed a node type D into field C
- node D gets rendered using a special node-embed--D.tpl.php
After some investigating I put a drupal_set_message() into the template and found out, that the template gets called TWICE when the cck_block is displayed (weird- only one of the calls makes it into $content though). So I wouldn't mind because the output is like I expect it, but unfortunately my template does some very much time consuming file_get_contents() calls so every embedded node calls this function twice and the page load nearly doubles due to this issue.
Any hint appreciated!

Comments

thommyboy’s picture

i did setup a clean drupal installation with some very basic contenttypes to demonstrate the effect. if someone is interested in having a look at it, i could provide the login... this effect only occurs when using cck_blocks

dan.nsk’s picture

This issue could definitely be marked as duplicate of #833730: Cck block display settings override basic node settings.

damien_vancouver’s picture

I'm travelling right now but when I get back (in a couple days) I'll have a look. If it's indeed the same problem / solution as #833730: Cck block display settings override basic node settings. it should be easy to backport the same type of fix to the 6.x branch.

thommyboy’s picture

that would be great!

DaPooch’s picture

Was this ever resolved for the 6x branch? Supposedly this issue is also responsible for causing a conflict between cck_blocks and webform_conditionals due to it adding js twice (http://drupal.org/node/1215908#comment-6867148) and I'm trying to find the best resolution for that.

damien_vancouver’s picture

Status: Active » Needs work

Looks like what we need is a 6.x backport of the patch in #24 from #833730: Cck block display settings override basic node settings..

Here is the commit of what made it into 7.x as a result of that: http://drupalcode.org/project/cck_blocks.git/commitdiff/f56075d

But, the patch is using the 7.x API fucntions field_attach_prepare_view(), entity_prepare_view(), and then field_attach_view() to create $built_nodes['nid'] (instead of node_build_content() which is what we don't want running twice).

before 7.x patch:

   // build the node in cck_blocks mode if that hasn't been done yet
     if (!isset($built_nodes[$nid])) {
      node_build_content($node, 'cck_blocks');
      $built_nodes[$nid] = $node;
    }
    else {
      $node = $built_nodes[$nid]; // I don't think this $node var is actually used after this, which is why the patch removed it!
   }
 

after 7.x patch:

  // build the node using the cck_blocks view mode if that hasn't been done yet
   if (!isset($built_nodes[$nid])) {
     field_attach_prepare_view('node', array($node->nid => $node), 'cck_blocks');
     entity_prepare_view('node', array($node->nid => $node));
     $built_nodes[$nid] = field_attach_view('node', $node, 'cck_blocks', $node->language);
   }      

So, we need the same kind of technique in 6.x, but using the 6.x API. I must confess I was in Perl land for Drupal 6 so I skipped that version altogether and I'm totally unfamiliar with the API. Can someone attempt a backport and post the patch here?

DaPooch’s picture

Anyone have any ideas on this? It's still causing trouble for me with Webform Conditionals module. My understanding is the node_build_content function is causing form_alter to run twice which is screwing things up. See http://drupal.org/node/1587394#comment-6994402