I have a view with a content pane display, with a footer with 'Display even if view has no result' set. When this pane is displayed by a panels page and the view result is empty (no rows), the footer isn't displayed. Where there are rows, the footer displays as expected.

I believe the culprit is in function views_content_views_panes_content_type_render(). This section of code has few comments, so I don't know if this patch is the correct or best fix, but it works for me. It would be nice to get a comment for this if statement at least.

CommentFileSizeAuthor
ctools_views_footer_when_empty.patch776 bytescedarm

Comments

merlinofchaos’s picture

Hmm. A work around would be to place something in the empty text, even if it is just a space. This patch does make some level of sense but I am not sure I like having to manually check this stuff.

merlinofchaos’s picture

Status: Needs review » Closed (won't fix)

In fact, no. The *intent* is that panes hide themselves if there is no content, unless there is an empty text or the style says to render even if empty.

cedarm’s picture

Sorry Earl, I'm missing something. What do you mean by "style" here? Are we talking on the views or panels level?

Really this is just a usability issue. From a user perspective if I check the "Display even if view has no result" box then I expect the resulting pane should never hide itself.

Also, just checked our production site and I need to clarify. The view display is in fact a block and not a content pane as initially stated. Not sure if this matters.

merlinofchaos’s picture

Status: Closed (won't fix) » Active

Ok, I'm convinced to think about this. However, the check is too complex where it is.

There could be other reasons that other displays have for choosing whether or not to display, so the logic should be made into a method that can easily be overridden by the display and thus more easily used in other situations.

merlinofchaos’s picture

Project: Chaos Tool Suite (ctools) » Views (for Drupal 7)
Version: 6.x-1.2 » 6.x-2.x-dev

I think Views has to provide the mechanism properly.

iamjon’s picture

I've marked this as an unassigned task. If anyone would like to role up their sleeves and take it upon themselves to write a patch it would be awesome

ayalon’s picture

I have no run into the same problem. The footer is not rendered. I tried to fix this but the its a deep problem.

modules/ctools/views_content/plugins/content_types/views.inc
line 211:

  if (empty($view->result) && !$view->display_handler->get_option('empty') && empty($view->style_plugin->definition['even empty'])) {
    return;
  }

Here is the break. Maybe we could add a check here if the footer / header is not empty and then render the pane.

iamjon’s picture

hi ayalon i spoke with merlinofchaos about your attempt on irc, here are his comments

(10:09:23 PM) merlinofchaos: iamjon-home: Ahh. Ok, what I want there is for views itself to have an easy function to call that compiles all of those checks, that any display can just use. It's probably a method on the basic views_plugin_display
(10:10:13 PM) merlinofchaos: Something like $display::result_is_empty() or something
(10:10:23 PM) merlinofchaos: And it passes checks through to everything that matters.
(10:10:33 PM) merlinofchaos: Maybe it should be on view
(10:10:46 PM) merlinofchaos: if ($view->result_is_empty()) { return; }

Hope this helps

iamjon’s picture

Status: Active » Closed (cannot reproduce)

Closing from a lack of activity.

babbage’s picture

Status: Closed (cannot reproduce) » Needs work

Curious why this was closed due to "lack of activity", as the bug remains, and is easy to reproduce.

dawehner’s picture

Status: Needs work » Closed (duplicate)

There is another issue about the exact same topic: #1217394: Change notice: "Display even if view has no result" not working though i doubt this method can be used for views2