If you create a block view and define another view to be used when the first view has no results, the title of the first block is still displayed above the block - even if the second view has a different title.

I tried changing the render() function in views_handler_area_view.inc to do a set_title(), but this doesn't seem to work. Any ideas?

Files: 
CommentFileSizeAuthor
#12 1388332-global-views-area-titles-and-tokens-12.patch3.81 KBjpstrikesback
PASSED: [[SimpleTest]]: [MySQL] 1,603 pass(es).
[ View ]
#10 1388332-global-views-area-titles-and-tokens-10.patch3.9 KBjpstrikesback
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1388332-global-views-area-titles-and-tokens-10.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#8 global-views-area-titles-and-tokens.patch3.91 KBjpstrikesback
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch global-views-area-titles-and-tokens.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Title:No results behavior - View Area does not inherit titles for blocksNo results behavior - Allow View Area to push title to main view.
Category:bug» feature

This seems to be like a valid behavior at the moment,
so what about a feature request to "pull title" from the subview.

Hi Daniel,

thanks. Just wondering: when is an issue a bug and when is it a feature request? When you can define a title, but it isn't used, isn't it just a bug? If it was meant to be this way; shouldn't there be a message that it works this way? It took me quite a while to figure out the problem.

I think there is no easy way to define a 100% definition what is what, especially in this case, it seems to be that the title from the min view wasn't expected to be pulled from the subview, so adding a feature is better then fixing a bug, but that's my perspective.

In general i prefer to add features instead of changing current behavior, you newer know whether people might rely on that.

+1 Just ran into this issue today and would love better title management for no results views.

Another +1. I'll be looking into this tonight, for sure, and see what I can hack together.

You have to use $view->set_title('new title'); to override the title of the view.

This would be much appreciated. So far I've been working around it with a kludgy combination of block Views for the true content and different page Views (chained together by no results behavior) to handle the titles.

Status:Active» Needs review
StatusFileSize
new3.91 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch global-views-area-titles-and-tokens.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Here's a patch that does this but I want to see it pass tests. The way it brings in the titles is maybe messy, and the way it does token replacement(by building another view side by side) is kinda ugly.

Any ideas on how to do this better are welcome. I'd like to see if I can get the tokens & substitutions passed thru, but that may be a luxury I can't afford...

Status:Needs review» Needs work

The last submitted patch, global-views-area-titles-and-tokens.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new3.9 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1388332-global-views-area-titles-and-tokens-10.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

And again, with feeling

Status:Needs review» Needs work

The last submitted patch, 1388332-global-views-area-titles-and-tokens-10.patch, failed testing.

StatusFileSize
new3.81 KB
PASSED: [[SimpleTest]]: [MySQL] 1,603 pass(es).
[ View ]

Shoulda read that test log a little closer.

Status:Needs work» Needs review

Wowza, so far so good.

The fact that the inherit_title & inherit_first_for_tokens depend on arguments being present may be something to change but it would probably kill something somewhere so I left it as only for usage when arguments are passed from the parent to the child...

Also maybe a && !empty($this->view->args) should be in the $views_copy creation condition to save on building a second object in memory, then again, maybe this is so flipping bad that none of that matters, so I'll leave it 'til there is further input

Confirmed working on 7.x-3.5.

Works absolutely perfectly, I searched for a solution and came across this patch.

I have an e-commerce site that basically shows a view with the subcategories if no products are found, this enables the title of the subcategory view to come through when no results are found.

Before the patch I was left with an uncoverted token, when no results were found, which I couldn't override.

I just came across this today.

My use case is that I am using views + views panel fields, to create user tabs of content.

For example: I would like the user profile to have user tabs for user generated content. If a user does not have any content, my token titles show [field-firstname] [field-lastname] Generated content.

@jpstrikesback
-The patch had a couple of whitespace errors but it still applied. Unfortunately I am still seeing the token fields instead of the values. Not sure if there was something that I needed to do for views to see this patch has been applied. I cleared the cache and resaved my view. Any help would be much appreciated.

I am using Views 7.x-3.5+24-dev

Ooops, made that before I started using Dreditor. I actually made it into a separate module so I could use it and update views :) I'll upload a sandbox late tonight or tomorrow, If I forget please feel free to remind me :)

Regarding the token names showing up, if there are no results they will show up as raw text (like [title]'s posts) If I recall correctly (as they come from the first row) Any ideas for a fallback?

Any chance of getting this committed or the module out (at least in dev on drupal?).

As a fallback, could we simply, just not modify the title, and use the parents default title? i.e. only override title from no results view if a token actually exists.

Cheers.