Steps to reproduce:
* Test a weight view (tested the module's default page display, as well as cloning it for a block display).
* Edit the Field: Title, by unchecking "Link this field to the original piece of content".
* When viewing the page or block with this view, I get these errors:

Notice: Undefined property: stdClass::$nid in weight_handler_field_weight->views_form() (line 27 of PATH_TO_THEME/modules/weight/views/weight_handler_field_weight.inc).
Notice: Undefined property: stdClass::$nid in weight_handler_field_weight->views_form() (line 39 of PATH_TO_THEME/modules/weight/views/weight_handler_field_weight.inc).
Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in weight_handler_field_weight->views_form() (line 40 of PATH_TO_THEME/modules/weight/views/weight_handler_field_weight.inc).
Notice: Undefined property: stdClass::$nid in weight_handler_field_weight->views_form() (line 47 of PATH_TO_THEME/modules/weight/views/weight_handler_field_weight.inc).

Comments

davisben’s picture

I was unable to reproduce this. It is working as expected after following your steps. One thing that looks odd to me me is the path. Is there a reason the module is under your theme's directory?

davisben’s picture

I was unable to reproduce this. It is working as expected after following your steps. One thing that looks odd to me me is the path. Is there a reason the module is under your theme's directory?

echoz’s picture

Ooops, I just wrote that incorrectly, that was meant to be - path to - sites/all/modules.
Thanks for checking, I ended up working around it by rewriting to have it a link to the node edit page. Now I'm curious what's different about my setup. I'll see what happens in future testing.

davisben’s picture

If you export your view and paste it here I'll compare it against the working one I have.

echoz’s picture

Thanks. Here’s the module’s default view (which I’m not using, but results in a clean demonstration of my errors). I have one simple content type using Weight. The only change to the default view, same as described in the issue summary, is the Field: Title has "Link this field to the original piece of content" unchecked.

$view = new view;
$view->name = 'weight';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Weight';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Weight';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'assign node weight';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'title' => 'title',
  'weight' => 'weight',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'title' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'weight' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
);
$handler->display->display_options['style_options']['override'] = 1;
$handler->display->display_options['style_options']['sticky'] = 0;
$handler->display->display_options['style_options']['empty_table'] = 0;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['title']['link_to_node'] = 0;
/* Field: Weight: Weight */
$handler->display->display_options['fields']['weight']['id'] = 'weight';
$handler->display->display_options['fields']['weight']['table'] = 'weight_weights';
$handler->display->display_options['fields']['weight']['field'] = 'weight';
$handler->display->display_options['fields']['weight']['label'] = '';
$handler->display->display_options['fields']['weight']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['weight']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['weight']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['weight']['alter']['external'] = 0;
$handler->display->display_options['fields']['weight']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['weight']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['weight']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['weight']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['weight']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['weight']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['weight']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['weight']['alter']['trim'] = 0;
$handler->display->display_options['fields']['weight']['alter']['html'] = 0;
$handler->display->display_options['fields']['weight']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['weight']['element_default_classes'] = 1;
$handler->display->display_options['fields']['weight']['hide_empty'] = 0;
$handler->display->display_options['fields']['weight']['empty_zero'] = 0;
$handler->display->display_options['fields']['weight']['hide_alter_empty'] = 1;
/* Sort criterion: Weight: Weight */
$handler->display->display_options['sorts']['weight']['id'] = 'weight';
$handler->display->display_options['sorts']['weight']['table'] = 'weight_weights';
$handler->display->display_options['sorts']['weight']['field'] = 'weight';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Weight: Enabled */
$handler->display->display_options['filters']['weight_enabled']['id'] = 'weight_enabled';
$handler->display->display_options['filters']['weight_enabled']['table'] = 'weight_settings';
$handler->display->display_options['filters']['weight_enabled']['field'] = 'weight_enabled';
$handler->display->display_options['filters']['weight_enabled']['value'] = '1';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'weight';

davisben’s picture

This is being caused by the nid not being passed to the view when "Link this field to the original piece of content" is unchecked. A quick fix is to add a nid field, excluded from the display. I'll need to look into a better, permanent solution.

davisben’s picture

Status: Active » Fixed

This is fixed now. I'm adding the nid as an additional field in the weight views handler.

Status: Fixed » Closed (fixed)

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