When ticking the checkbox "Show the empty text in the table" in Editable Views Table Settings the following error appear if there are no results in the table.

Notice: Undefined variable: result_indexes in editableviews_plugin_style_row_edit_table->insert_form_elements() (line 222 of /sites/all/modules/editableviews/editableviews_plugin_style_row_edit_table.inc).
Notice: Undefined variable: result_indexes_reverse in editableviews_plugin_style_row_edit_table->insert_form_elements() (line 223 of /sites/all/modules/editableviews/editableviews_plugin_style_row_edit_table.inc).
Notice: Undefined variable: result_indexes in editableviews_plugin_style_row_edit_table->insert_form_elements() (line 222 of /sites/all/modules/editableviews/editableviews_plugin_style_row_edit_table.inc).
Notice: Undefined variable: result_indexes_reverse in editableviews_plugin_style_row_edit_table->insert_form_elements() (line 223 of /sites/all/modules/editableviews/editableviews_plugin_style_row_edit_table.inc).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

It looks like what happens is that when you enable that option, Views renders the table display plugin. This results in a special case where the plugin is used with an empty result set. The code in this module isn't designed to cope with that.

Should be fairly easy to fix with a few early bail-outs in functions, along the lines of:

if (empty($result)) {
  return; // or could be return '' or return array() depending on what's expected
}

If you're able to investigate and make a patch that would be great!

doppel’s picture

Hello, I made a patch for this.

joachim’s picture

Status: Active » Needs work

I don't quite follow what you're doing.

If either of the variables that are going to be put into the array are empty, then you're putting an empty string in? What were the values that tested as empty?

Also, surely we can bail earlier than this?

sukh.singh’s picture

@joachim is correct, there is any issue when no result is returned by the query. I am suppling a patch for this as follows

sukh.singh’s picture