I updated from version 23/2/2011 to today's version 14/3/2011. On every view page, I get the following message for every line shown on the page:
Notice: Undefined index: {index} in views_handler_field->get_value() (line 738 ...\views\handlers\views_handler_field.inc).
For node views, {index} = format
For Term views, {index} = taxonomy_term_data_format

Comments

johnv’s picture

This eliminates the message, and my views look OK again:

-  $alias = isset($field) ? $this->aliases[$field] : $this->field_alias;
+  $alias = ( isset($field) && isset($this->aliases[$field]) ) ? $this->aliases[$field] : $this->field_alias;
johnv’s picture

Title: 'Undefined index: taxonomy_term_data_format' & '...format' after upgrade to new dev-release » 'Undefined index: format' & '... taxonomy_term_data_format' after upgrade to new dev-release
Status: Active » Needs review
bojanz’s picture

Status: Needs review » Postponed (maintainer needs more info)

Not necessarily correct.
We want the "format" column value, it is not present for some reason, and your code just returns the default column (which might be format, but it might be something else..).

What we need to figure out is which handler is calling the function with the wrong value.
Can you provide an exported view? Cause I'm having trouble reproducing.

johnv’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new36.39 KB

See attached file with a simple Term view. 1 default display + 2 page displays, each for another Vocabulary.

johnv’s picture

bojanz’s picture

StatusFileSize
new635 bytes

Test this patch. It might not fix the notice, but it's definitely part of the final fix.

bojanz’s picture

Status: Active » Needs review
johnv’s picture

StatusFileSize
new41.91 KB

I added your patch, removed mine. The results are:
- the error for taxonomy_term_data_format has gone
- the error for format still exists
I have stripped and appended one of my node views, where the error still exists.

dawehner’s picture

StatusFileSize
new698 bytes

What about this patch?

Jerome F’s picture

I tried the patch in #9 and I still get :
Notice : Undefined index: format in views_handler_field->get_value() (line 738 in (...)/public_html/sites/all/modules/views/handlers/views_handler_field.inc).

johnv’s picture

Same result as Jerome for patch #9: still errors in 'format' . The other error with 'taxonomy_term_data_format' is now OK.

johnv’s picture

Status: Needs review » Needs work

PS. I set the message to critical, because the message are in the user's face. Was that the correct decision?

jon nunan’s picture

#3 For node views I believe I tracked down which call to 'get_value' is causing it. It's part of node edit links.

/views/module/node/views_handler_field_node_link_edit.inc

line 18:
$node->format = $this->get_value($values, 'format');
If I change that 'format' to 'format2' the error now complains about 'format2' to being the missing index.

Sorry, haven't got my head around the whole views thing yet, so no patch, but commenting out the line above seems to work...

bojanz’s picture

Thanks, meatsack. This is the crucial info we need.

Looking at the get_values patch, the format call was added in it:

diff --git a/modules/node/views_handler_field_node_link_edit.inc b/modules/node/views_handler_field_node_link_edit.inc
index 3caf66d..b6bf4c3 100644
--- a/modules/node/views_handler_field_node_link_edit.inc
+++ b/modules/node/views_handler_field_node_link_edit.inc
@@ -12,9 +12,10 @@ class views_handler_field_node_link_edit extends views_handler_field_node_link {
   function render_link($data, $values) {
     // ensure user has access to edit this node.
     $node = new stdClass();
-    $node->nid = $values->{$this->aliases['nid']};
-    $node->uid = $values->{$this->aliases['uid']};
-    $node->type = $values->{$this->aliases['type']};
+    $node->nid = $this->get_value($values, 'nid');
+    $node->uid = $this->get_value($values, 'uid');
+    $node->type = $this->get_value($values, 'type');
+    $node->format = $this->get_value($values, 'format');
     $node->status = 1; // unpublished nodes ignore access control
     if (!node_access('update', $node)) {
       return;

Same for the delete link.
dereine, do you know why? Yours was the first version of the patch.
Only the node links (ones for revisions as well) got the format added.

So, we either need to kill the added format lines, or actually make sure that the format column is added to the query.
Then merge those changes with mine in #6, and we're good to go.

jastraat’s picture

subscribing

dawehner’s picture

You basically can't trust me....
The only reason i could think of was a stupid c&p error.

Go ahead and provide a patch.

bojanz’s picture

Status: Needs work » Needs review
StatusFileSize
new3.71 KB

That's why we have -dev.
Though it would be nice if we had a usable release that's not -dev :)

calbert’s picture

@ #17 how do I run this patch??

bojanz’s picture

cd views/
patch -p1 < 1091980.patch

calbert’s picture

I am still getting the following error

•Notice: Undefined index: format in views_handler_field->get_value() (line 738 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/handlers/views_handler_field.inc).
•Notice: Undefined index: format in views_handler_field->get_value() (line 738 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/handlers/views_handler_field.inc).
•Notice: Undefined index: format in views_handler_field->get_value() (line 738 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/handlers/views_handler_field.inc).
•Notice: Undefined index: format in views_handler_field->get_value() (line 738 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/handlers/views_handler_field.inc).
•Notice: Undefined index: format in views_handler_field->get_value() (line 738 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/handlers/views_handler_field.inc).
•Notice: Undefined index: format in views_handler_field->get_value() (line 738 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/handlers/views_handler_field.inc).
•Notice: Undefined index: format in views_handler_field->get_value() (line 738 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/handlers/views_handler_field.inc).

Here is the code, please any help .. I am in over my head ,,

function get_value($values, $field = NULL) {
738 $alias = isset($field) ? $this->aliases[$field] : $this->field_alias;
739 if (isset($values->{$alias})) {
740 return $values->{$alias};

johnv’s picture

Status: Needs review » Needs work

patch 17 removes all messages.
I found a similar 'format' statement in views_handler_field_node_link_translate.inc. Should that file be changed?

calbert’s picture

Status: Needs work » Needs review

@ #13

My code is not the same here is the /views/module/node/views_handler_field_node_link_edit.inc

1 <?php
2 /**
3 * Field handler to present a link node edit.
4 */
5 class views_handler_field_node_link_edit extends views_handler_field_node_link {
6 function construct() {
7 parent::construct();
8 $this->additional_fields['uid'] = 'uid';
9 $this->additional_fields['type'] = 'type';
10 }
11
12 function render_link($data, $values) {
13 // ensure user has access to edit this node.
14 $node = new stdClass();
15 $node->nid = $this->get_value($values, 'nid');
16 $node->uid = $this->get_value($values, 'uid');
17 $node->type = $this->get_value($values, 'type');
18 $node->status = 1; // unpublished nodes ignore access control
19 if (!node_access('update', $node)) {
20 return;
21 }
22
23 $this->options['alter']['make_link'] = TRUE;
24 $this->options['alter']['path'] = "node/$node->nid/edit";
25 $this->options['alter']['query'] = drupal_get_destination();
26
27 $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
28 return $text;
29 }
30 }

calbert’s picture

Patch #17 did nothing for me, same error..

bojanz’s picture

@21
No, that one's fine.

Waiting for other people to test. Right now it seems that we have a 50% success rate :)

bojanz’s picture

Title: 'Undefined index: format' & '... taxonomy_term_data_format' after upgrade to new dev-release » Undefined index: format

Changing title

jastraat’s picture

That fixed the error for me -

johnv’s picture

@22, I applied the patch by hand, so I am not sure about if the file is exactly the same. I just removed/changed the lines.

calbert’s picture

any update on this problem for me .. please?

I applied the patch and didn't fix my problem..

•Notice: Undefined index: format in views_handler_field->get_value() (line 738 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/handlers/views_handler_field.inc).
•Notice: Undefined index: format in views_handler_field->get_value() (line 738 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/handlers/views_handler_field.inc).
•Notice: Undefined index: format in views_handler_field->get_value() (line 738 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/handlers/views_handler_field.inc).

johnv’s picture

Calbert, which version of -dev have you installed? I hope the 'latest'?

calbert’s picture

views-7.x-3.x-dev

jon nunan’s picture

@ #30
a new version of 7.x-3.x-dev comes out every couple of days, as its just a development snapshot of that branch it doesn't get a unique version number each time. If you downloaded it from drupal.org it should have a line from the packaging script in the views.info file, something like:

; Information added by drupal.org packaging script on 2011-03-14

If you can find that line and tell us the date, we'll know what snapshot you're on.

bojanz’s picture

Or someone can upload a patched archive for him to try...

klaus66’s picture

I tested the patch and it fixed the problem with the notice.

bojanz’s picture

Status: Needs review » Reviewed & tested by the community

3 confirmations. RTBC

calbert’s picture

Status: Reviewed & tested by the community » Needs review

@31

; Information added by drupal.org packaging script on 2011-03-14
version = "7.x-3.x-dev"
core = "7.x"
project = "views"
datestamp = "1300062218"

bojanz’s picture

Status: Needs review » Reviewed & tested by the community

Let's get the current patch in. It solves the problem for most people, and is definitely needed.
If calbert's problem persists, we'll debug it separately (by providing a views export, which he didn't do so far)

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed upstream.

calbert’s picture

Status: Fixed » Needs review

@#36 how do I provide a view export?

bojanz’s picture

Test first with the latest git version of views (or wait for dev until tomorrow). See if the problem is still there for you.
You have an export link in the views listing page, for each row (view).

bojanz’s picture

Status: Needs review » Fixed

Closing again until we have more data.

calbert’s picture

Status: Fixed » Needs review

I removed the old views downloaded the new one .. and now I get this error

* Notice: Undefined variable: field in ViewsUiBaseViewsWizard->default_display_options() (line 521 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/plugins/views_wizard/views_ui_base_views_wizard.class.php).
* Notice: Undefined variable: field in ViewsUiBaseViewsWizard->default_display_options() (line 522 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/plugins/views_wizard/views_ui_base_views_wizard.class.php).
* Notice: Undefined variable: field in ViewsUiBaseViewsWizard->default_display_options() (line 519 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/plugins/views_wizard/views_ui_base_views_wizard.class.php).
* Notice: Undefined index: table in views_plugin_display->get_plugin() (line 708 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/plugins/views_plugin_display.inc).
* Notice: Undefined index: table in views_plugin_display->get_plugin() (line 708 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/plugins/views_plugin_display.inc).
* Notice: Undefined index: table in view->init_query() (line 571 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/includes/view.inc).

johnv’s picture

@calbert, congratulations, you're now one of merlin's launching customers! You have two actions:
- download also latest CTools
- read this: http://www.angrydonuts.com/views-for-drupal-7-enters-a-new-era
Good luck in the next fase of your quest for the working patch ;-)

bojanz’s picture

Status: Fixed » Needs review

Accidental doublepost

bojanz’s picture

Status: Needs review » Fixed

Latest ctools means today's git (tomorrow's dev). Alpha4 has a bug causing module provided default views (such as the ones from drupal commerce) to not show up.

I still haven't gotten a views export from calbert which would help me help him.

Also, "needs review" means there's a patch. There's no patch here.
Closing this issue since you don't mention seeing the format error. New UI notices can be handled in a separate issue.

johnv’s picture

Status: Needs review » Fixed

As a wise man once (yesterday) said:

it would be nice if we had a usable release that's not -dev :)

calbert’s picture

* Notice: Undefined property: stdClass::$display_plugin in view->init_display() (line 239 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/includes/view.inc).
* Notice: Undefined index: table in view->init_query() (line 571 of /var/www/vhosts/metrosource/drupal-7.0/modules/views/includes/view.inc).

The new version of this is giving me the following errors.

bojanz’s picture

Which has nothing to do with the issue you posted in.

Status: Fixed » Closed (fixed)

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

johnv’s picture

Title: Undefined index: format » Notice: Undefined index: format in views_handler_field->get_value() (line 738 of views_handler_field.inc).