Working on the design of Drupal Commerce, I ran into #1029638: Display empty text messages for main listing Views in tables.

In Drupal 7 we have introduced the concept of empty table messages, and made an effort for consistency to provide tables when there is no content. The reason behind this is that we give users an "idea" what will happen when you add an item (whatever that may be).

Since more and more modules will start leveraging Views to build administrative interfaces, it will be useful if Views provides the ability to do this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev

Agreed. No reason not do to this for 6.x-3.x as well.

dawehner’s picture

Status: Active » Needs review
FileSize
4.35 KB

And here is a patch.

Added a new api function so hide the result via a function of the style plugin. It's even a bit cleaner from my perspective.

webadpro’s picture

Will this patch be coded for version2 also?

merlinofchaos’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)

Sorry, this won't be committed to 2.x.

Committed to 6.x-3.x. Doesn't apply to 7.x-3.x and I tried a manual bit of porting but things look sufficinetly different that I stopped.

dawehner’s picture

Status: Patch (to be ported) » Fixed

Commited to 7.x-3.x

Status: Fixed » Closed (fixed)

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

webadpro’s picture

I have finally made the changes to get it working in Views 2.

Some minor changes needs to be done from the patch but nothing big.

Changes to the patch.

Change:
$vars['rows'][0][0] = $view->display_handler->render_area('empty');
To:
$vars['rows'][0][0] = $view->display_handler->render_empty();


Change:
<td class="<?php print $field_classes[$field][$count]; ?>" <?php print drupal_attributes($field_attributes[$field][$count]); ?>>
To:
<td class="views-field views-field-<?php print $fields[$field]; ?>" <?php print drupal_attributes($field_attributes[$field][$count]); ?>>

Cheers