Hi. Was unable to find a open issue on this so here we go:
Latest Views 3 dev.
I have a image-field and try to limit the delta so it only show one of the images (the first). The view works just fine until I try to define the limit: "show 1 value - starting at 0.
Notice: Undefined index: nn in views_handler_field_field->get_items() (line 555 drupal/sites/all/modules/views/modules/field/views_handler_field_field.inc).
nn [$langcode] is the default language the site is running with. Field translation is not active and this content type does not have "Multilingual support " active.
I had a look into the code at my best ability and it looks to be this code that throws the error:
// We are supposed to show only certain deltas.
if ($this->limit_values) {
$all_values = $entity->{$this->definition['field_name']}[$langcode];
if ($this->options['delta_reversed']) {
$all_values = array_reverse($all_values);
}
And it is doomed to fail then there is non langcode defined in the array $this->definition['field_name']
that contain only string(15) "field_img_slide"
Removing [$langcode] also remove the error message but the imagefield it self is still missing.
from line 574:
if (isset($all_values[0][$new_delta])) {
$new_values[] = $all_values[$new_delta];
}
This code never validate and $new_value array is returned empty. It is getting late so I'm stopping my quest for today, tired so I could be barking up the wrong tree here.
Best regards
Steinmb
Comments
Comment #1
dawehnerThis line is causing the notice.
For field_name = 'field_body' it's $entity->field_body[$langcode].
So the problem is that your entity doesn't have the specific field on it.
But if you look up some lines you see this code
So this is all very strange.
Can you describe a way to reproduce the problem?
Comment #2
mathieuhelie CreditAttribution: mathieuhelie commentedSorry for the hijack but can you describe what feature of Views 3 allows filtering out images to the first delta? A straight filter no longer seems to work.
edit;
This was actually a bug and you must run DEV of Views to use this feature.
#1017128: No way to render a single delta of a multivalue field
Comment #3
steinmb CreditAttribution: steinmb commentedHmm this is a clean D7.0 installation, nothing special really.
I have a local installation sandboxed snapshot of the site before I created the view. I might try and reproduce it on this.
Could i18n have done some funky stuff perhaps? I mean does every field have [$langcode] attached to them?
@mathieuhelie It is not a filter, you define this on the field you use in the view.
Comment #4
metalinspired CreditAttribution: metalinspired commentedHi. Same problem here.
I'm fairly new to Drupal and after dumping some variables I found that images are language independent and that seems to cause the problem.
Here's what I did to solve the problem but someone with more knowledge on developing for Drupal (I have almost none for now :D ) should change this not to use hard coded values.
In views_handler_field_field.inc changed line 555 from
$all_values = $entity->{$this->definition['field_name']}[$langcode];
to
$all_values = $entity->{$this->definition['field_name']}['und'];
and on line 580 from
$entity->{$this->definition['field_name']}[$langcode] = $new_values;
to
$entity->{$this->definition['field_name']}['und'] = $new_values;
Edit: This only worked for dummy content created by Devel module. Not a valid fix!!!
Comment #5
dawehnerlangcode should contain the right language.
@steinmb
Can you describe the setup to reproduce the problem?
Comment #6
steinmb CreditAttribution: steinmb commentedDevel module? Waaaait a minute, my content is also created by the devel module. Manually created a node and the delta setting actually workes just fine! So it is a but in the devel module then?
This site is running with only one language enabled (nn), still devel module managed to create language neutral (the array is not keyed with the active language (nn) but with "und") nodes? Hell multilingual support is even off on the content type views failed on. @dereine I might have wasted your time on this, sorry.
--
Stein, still pining for the fjords
Comment #7
dawehnerAs long the issue is fixed i'm fine ;)
Comment #8
steinmb CreditAttribution: steinmb commentedHi
Turned out that this bug might belong to you guys?
Comment #9
chup CreditAttribution: chup commentedProblem is not fixed!
I have this problem with myself-created nodes. After enabling second language all the images (through the field) dissapeared and I have same notice error.
Comment #10
steinmb CreditAttribution: steinmb commented@chup: Nones have ever claimed it is ;)
I'm still waiting for any of the maintainers to pick up this issue.
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentedFixed. if you have a single enabled language, your nodes will now be marked with that language. if you have multiple languages, use the --languages option to specify.