Hey,

i'm not sure if this is really DS related but you get the following error:

Fatal error: Unsupported operand types in /var/spool/www/user/aegir/drupal-7.7/modules/node/node.module on line 1363

Add a view with a block display and add it via the DS block field. I wanted to create a related products view but just did a listing without any filtering. Now when you are on a node which also is in the 'related product' view block it breaks.

gr Volkan

CommentFileSizeAuthor
#3 1264386.patch3.65 KBswentel

Comments

swentel’s picture

I can reproduce but haven't looked further. My guess is that there's a loop going on here, will investigate more later.

dazz’s picture

subscribe

swentel’s picture

Status: Active » Fixed
StatusFileSize
new3.65 KB

Ok, so it's impossible to render a node inside a node like this and I can't find a way to find recursive loops here to break them off if needed (except hacking in core, which is not a good idea of course). I've added a new menu item at admin/structure/ds/emergency which allows you to break off theming through DS temporarily so you can fix any configuration errors. This is really the best that I can do right now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jramby’s picture

Status: Closed (fixed) » Active

Hi there,

Is there any achievements on this till these days about commits on the drupal module? Is it commited somewhere on dev or other version?

Thanks, it's such a powerfull module that you've done, thanks again.

PS : I changed status to active, I don't know if in "closed(fixed)" status this message will be seen.

swentel’s picture

Status: Active » Closed (fixed)

It's in the dev version yes, even in an official release too.

jramby’s picture

Status: Closed (fixed) » Active

Hi again,

On these version : 7.x-1.x-dev, 7.x-2.0-rc-1

I'm still getting the same errors on the node pages that have been opened with the buggish version.

What should I do to get rid of this error ont these pages?

Thanks.

swentel’s picture

You need to go to 'emergence' and skip the node rendering. Most likely, you're trying to render nodes inside other nodes which simply isn't possible at all.

jramby’s picture

Status: Active » Closed (fixed)

Thank you swentel. I rendered fields in the view and it's OK.

j0rd’s picture

I've run into this too.

I was re-factoring my view modes to be more modular....but after all the work, I come to find this bug.

Use case was

FULL VIEW MODE

* header
** title    
** avatar
* body   
** field 1 
** field 2 

TEASER VIEW MODE (duplicate title & avatar fields)

* title
* avatar

REFACTORED FULL MODE

* header
** TEASER <strong>(via teaser view mode using a DS_FIELD_TYPE_FUNCTION field)</strong>
* body
** field 1
** field 2

Reason I want to do this is, my TEASER has about 18 fields, and is used on 4 different node types. Any change in TEASER, also requires the change in FULL if I'm simply duplicating fields. If I could bundle them up, I would only have to make the change once.

Is there another way to do this? Or am I just going to have to do it all manually.

hazah’s picture

I am interested in knowing what the actual issue is. Where is this failing in the core? Had anyone investigated that far?

ressa’s picture

I was inserting an Openlayers map block with a contextual filter in a node, with a tool tip using <entire node> under "Description Content". This rendered the teaser, which was the node itself, so that was a node-inside-a-node situation.

After de-selecting <entire node> and set "Description Content" to nothing, the map shows up, and no more errors. DS rocks :-)

davvid’s picture

In my case I got error while indexing items with Search API (Solr).
In node display mode (Full) I have DS field with function to render view.
There is filed (reference to node) in this view which was set to display rendered node in display mode which doesn't exist. That was the problem even that the fileld was hidden.

drupst’s picture

Issue summary: View changes

diff --git a/ds.field_ui.inc b/ds.field_ui.inc
index 548bb91..26cbdc1 100644
--- a/ds.field_ui.inc
+++ b/ds.field_ui.inc
@@ -1295,6 +1295,10 @@ function _ds_field_ui_table_layouts($entity_type, $bundle, $view_mode, &$form, $
$options = array();
$ds_layout_settings = ctools_export_crud_load_all('ds_layout_settings');
foreach ($ds_layout_settings as $row) {
+ // Do not clone from form layouts.
+ if ($row->view_mode == 'form') {
+ continue;
+ }
if ($row->entity_type == $entity_type && !isset($row->settings['ds_panels'])) {
$options[$row->id] = drupal_ucfirst($row->entity_type) . ' > ' . drupal_ucfirst($row->bundle) . ' > ' . drupal_ucfirst($row->view_mode);
}
diff --git a/ds.layout.inc b/ds.layout.inc
index 0ca60b5..3fe9d37 100644
--- a/ds.layout.inc
+++ b/ds.layout.inc
@@ -60,3 +60,18 @@ function ds_layout_list() {

return $build;
}
+
+/**
+ * Emergency page
+ */
+function ds_emergency() {
+
+ $form['ds_disable'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Disable theming through Display suite'),
+ '#description' => t('In case you get an error after configuring a layout with DS which prints something like "Fatal error: Unsupported operand types", you can temporarily disable all DS theming by toggling this checkbox. In that case, you probably are trying to render an node inside a node, for instance through a view, which is simply not possible. See http://drupal.org/node/1264386.'),
+ '#default_value' => variable_get('ds_disable', FALSE),
+ );
+
+ return system_settings_form($form);
+}
diff --git a/ds.module b/ds.module
index 827d6e1..0433633 100644
--- a/ds.module
+++ b/ds.module
@@ -69,6 +69,16 @@ function ds_menu() {
'file path' => drupal_get_path('module', 'system'),
);

+ // Emergency page
+ $items['admin/structure/ds/emergency'] = array(
+ 'title' => 'Emergency',
+ 'description' => 'Temporarily disable theming via Display suite.',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('ds_emergency'),
+ 'access arguments' => array('admin_display_suite'),
+ 'file' => 'ds.layout.inc',
+ );
+
// Custom styles.
$items['admin/structure/ds/styles'] = array(
'title' => 'Styles',
@@ -614,6 +624,16 @@ function ds_get_field_value($key, $field, $entity, $entity_type, $bundle, $view_
function ds_field_attach_view_alter(&$build, $context) {
static $loaded_css = array();

+ // Global kill switch. In some edge cases, a view might
+ // be inserted into the view of an entity, in which the
+ // same entity is available as well. This is simply not
+ // possible, so you can temporarily disable DS completely
+ // by setting this variable, either from code or via
+ // the UI through admin/structure/ds/
+ if (variable_get('ds_disable', FALSE)) {
+ return;
+ }
+
// If views and core doesn't send information along on the entity,
// Display suite doesn't have a context to render the fields.
if (!isset($build['#entity_type']) && !isset($build['#bundle'])) {
diff --git a/modules/ds_extras/ds_extras.module b/modules/ds_extras/ds_extras.module
index aa73875..2ceeb5f 100644
--- a/modules/ds_extras/ds_extras.module
+++ b/modules/ds_extras/ds_extras.module
@@ -13,7 +13,7 @@ function ds_extras_menu() {

$items['admin/structure/ds/extras'] = array(
'title' => 'Extras',
- 'description' => 'Configure extra functionality for Display Suite.',
+ 'description' => 'Configure extra functionality for Display suite.',
'page callback' => 'drupal_get_form',
'page arguments' => array('ds_extras_settings'),
'access arguments' => array('admin_display_suite'),

skribbz14’s picture

This error is caused, sometimes, when a node is rendering a view and that view is also displaying that same node.

Example:
You're on the most recent blog post page and you want to render a view to display the five most recent blog posts. This blog post would be within that list.

If you tell the view to not include the current node within the list this will fix the issue. This is also better, because I doubt the user wants to click a link to a page they are already on.

This will show you how to do that:
https://www.drupal.org/node/131547

MarkBGH’s picture

#15 did the trick for me!

I was trying to figure out why it was only happening on new nodes, and it was because I had a view that displayed all of the "Latest" posts in a sidebar of those node pages. Thanks for the life saving tip skribbz14!

ryan258’s picture

Props to #15!

I was redoing the views/referencing and sure enough I had to blast out an old view that was relying on a reference field I had removed. Once I got rid of the one that shouldn't exist everything of that content type clicked and there was no more

Fatal error: Unsupported operand types in /modules/node/node.module on line 1419

I guess it would be better form to clean up the views/contexts before blasting fields out of content types :)

rcodina’s picture

#15 works for me too. Thank you so much!

kyuubi’s picture

Status: Closed (fixed) » Active

I am having this problem as well.

Is this caused by Display Suite?

I don't see why we shouldn't be able to have 2 nodes appear time on the same page without breaking the site.

Anyone has more info on this?

rcodina’s picture

@kyuubi I think this is not caused by Display Suite, it is just you can't display the same node twice. In my case, I was using Views module to display related nodes of one node and I had to make sure the same node wouldn't appear in that view to avoid the problem.

kyuubi’s picture

@rcodina I just use Drupal core displaying the same node twice presents no issues.

Only seems to become a problem with DS enabled.

rcodina’s picture

@kyuubi In my case, DS wasn't the problem. My problem was the one described in #15:

This error is caused, sometimes, when a node is rendering a view and that view is also displaying that same node.

So maybe this is a Views problem.

brandonc503’s picture

i added a dynamic field of entity > render node and got WSOD with

Fatal error: Unsupported operand types in /drupal/modules/node/node.module on line 1415

aspilicious’s picture

You can't embed the same node inside the current node....
That's probably your issue.

aspilicious’s picture

Status: Active » Closed (fixed)
rp7’s picture

I ran into this issue as well. I wanted to show the teaser view mode in a field, in the full view mode of the node.

I ended up creating a custom Display Suite field, with the following code:

  $clone = clone $field['entity'];
  unset($clone->_field_view_prepared);
  $build = node_view($clone, 'teaser');
  return drupal_render($build);
leon kessler’s picture

Ran into this as well (trying to embed an entity into itself using a DS dynamic field).

I digged around in core, turns out it's totally fine to embed a node within a node (just don't embed the same view mode, or it will obviously break the entire internet!)
I found that this code in node_view() that was causing the issue:

  // We don't need duplicate rendering info in node->content.
  unset($node->content);

Now I'm not entirely sure why this is needed, but the rather casual language of "We don't need" makes me think it may not be too critical (as apposed to say "Ensure there is no").

Anyhow, there's an easy way to add back in the $node->content, property. Do so like this...

function my_module_node_view_alter(&$build) {
  if ($build['#view_mode'] == 'my_view_mode') {
    $build['#node']->content = array();
  }
}

I'm only targeting a specific view mode here, just to try and prevent this hackery from inflicting any damage elsewhere.

Likewise the same goes for taxonomy terms...

function my_module_taxonomy_term_view_alter(&$build) {
  if ($build['#view_mode'] == 'my_view_mode') {
    $build['#term']->content = array();
  }
}
elektrorl’s picture

#27 works well in custom module or in template.php. Don't forget to change 'my_view_mode' with 'teaser' for example.