It seems like there should be a check to make sure the raw data for the column is available.
Attached patch adds such a check.

Comments

dawehner’s picture


    $render_array = field_view_field($entity_type, $entity, $this->definition['field_name'], $display, $langcode);

    $items = array();
    if ($this->options['field_api_classes']) {
      // Make a copy.
      $array = $render_array;
      return array(array('rendered' => drupal_render($render_array)));
    }

    foreach (element_children($render_array) as $count) {
      $items[$count]['rendered'] = $render_array[$count];
      $items[$count]['raw'] = $render_array['#items'][$count];
    }

I'm wondering why raw is not defined here.

Could it be that the result is empty on this column?

das-peter’s picture

Indeed I was dealing with empty fields #1020540: Add a "Hide Rewriting if field is empty" option as this notice showed up.
I was working with single checkboxes - and some of them were unchecked. Looks like these fields were reeeeeally empty ;)

maebelater’s picture

Status: Needs review » Reviewed & tested by the community

I've run into this issue when trying to output Media module field as link using tokens - namely, "Undefined index: raw in views_handler_field_field->add_self_tokens() in line 619"
This patch AND checking "Use field template" during field configuration made things manageable, thanks.

manuel garcia’s picture

Well, patch applies ok, and errors are gone... whether or not this is a symptom of a problem somewhere else, that's something that should be investigated.

manuel garcia’s picture

Well, patch applies ok, and errors are gone... whether or not this is a symptom of a problem somewhere else, that's something that should be investigated.

slashrsm’s picture

I have a different issue on the same place. Again field comes from media. In my case I get this error:


Cannot use object of type stdClass as array in /var/www/daniels/www/sites/polet.si/modules/contrib/views/modules/field/views_handler_field_field.inc on line 621

I used a step debugger and found out, that $item['raw'] is stdObject, but is expected to be an array. Should we check here if it is an object or array? Or it is this maybe media related bug?

dawehner’s picture

@slashrsm
What kind of field do you display there?

Perhaps it would help even more if you could provide the content of $item['raw'] here.

slashrsm’s picture

StatusFileSize
new2.07 KB

@dereine
It is media field. Content of $item['raw'] is attached.

dawehner’s picture

@slashrsm

Can you please create a new issue for this. This is another issue.

It is somehow required that you provide a way to reproduce this problem. Here i can use media module as token etc. without problems.

slashrsm’s picture

rszrama’s picture

Just +1'ing this issue. I turned it up when trying to use an empty text on a View. The problem isn't that the field has no data, it's if it has no data and you have assigned it to use empty text. Does the empty text work through a separate handler that still references the field info? That might explain why add_self_tokens() thinks it should find field data.

In any event, the patch is obviously an easy solution, though I wonder if the problem doesn't exist upstream.

klausi’s picture

Got bitten from this issue, too. Patch form #1 works fine, adding it to my distribution drush_make file.

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Doh!

Always filtered by "needs review"!

Status: Fixed » Closed (fixed)

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

servantleader’s picture

Is this fixed? I am having this exact error with the latest dev (Mar 14, 2011). Did the patch get in?

dopedwizard’s picture