Views does not display/render the empty text if the "Show the empty text in the table" option is not active.

I would have expected views to display the empty text without the surrounding table when the option above is unchecked.

The relevant code in theme/theme.inc is:

  if (empty($vars['rows']) && !empty($options['empty_table'])) {
    $vars['rows'][0][0] = $view->display_handler->render_area('empty');
    // Calculate the amounts of rows with output.
    $vars['field_attributes'][0][0]['colspan'] = count($vars['header']);
  }

Comments

Chris Matthews’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

The Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue

srees’s picture

In case this has any value to you anymore, I had a similar issue that appears closely related.

I found in my case that replacing render_area('empty') with render_empty() (a legacy function) worked. (Line 71 of theme.inc)

I kinda suspect that this is because the logic is inconsistent and poorly named, and the legacy functions in views_plugin_display.inc indicate this.

area_text's render(), which is called by render_area for the header, footer, and empty text, only shows the content if it is passed FALSE (or if the handler->options['empty'] is not empty).

For header and footer, we want the content to display when there are results, so it is passed $empty = FALSE for those in theme.inc, but the logic was failed to be reversed for the empty field, which we want to display when there are NOT results.

Line 71 probably should have been,

$vars['empty'] = $view->display_handler->render_area('empty', !$empty);

The only change is adding a shebang in the render_area argument....