Ability to override title of page views
prunelle - February 12, 2009 - 14:56
| Project: | Viewfield |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I have a "front-page" content type which is built with (actually) four CCK-viewfield fields and nothing else. Each of them is set to force a default view. When I create a node of that type, with the title "Hello" (nothing else), the title of that node doesn't become "Hello" but the title of the view display (default or page, in my case) chosen for the forced view of the last (higher weight) viewfield of the node. I hope it's clear enough .... In fact, after some tests, I've found the problem appears with the use of a second CCK-viewfield in the definition of the node type. With a unique viewfield, the node title is correct.
Any idea ?

#1
Extremely odd - I'll see if I can reproduce this one. What version of Drupal core and what version of CCK are you using? What version of Views? Are you using the latest development snapshot of viewfield?
Jer
#2
Great thanks for your answer Jer.
I've just reproduced this behavior with : Drupal 6.9 , CCK 6.x-2.1, Views 6.x-2.x-dev (02/18), and Viewfield 6.x-1.x-dev (02/11). It's very easy to reproduce.
Regards.
#3
Just wanted to chip in on this issue as I've just stumbled on the same behaviour with just 1 viewfield in the content type.
The viewfield seems to override the node title. When I remove the viewfield from the content type, the node title is displayed correctly.
*UPDATE*
If I change the view field to point to the View defaults instead of the page, the node title seems to display correctly. Maybe this can help in tracking down the issue?
#4
That is the expected behavior of a page view. Someone might be able to create a patch to make Viewfield restore the previous title every time a view is displayed in a node.
#5
Yes, but ... How do you expain that when the node contains a unique viewfield with a page view, the original node title is kept, and not replaced by the page view title ? The node title becomes wrong when you add a second viewfield with a page view.
#6
I cannot reproduce that on my site.
#7
May I ask you to try the following :
- create a content type with two "viewfield" fields
- those two fields has "Force default" and "Use a common default value for all nodes if the user does not override it on the node form" checked (aside, it seems that checking only "Force default" isn't enough to force a default ...)
- the first field content is forced to the default view : tracker, with the page display
- the second one is forced to the default view : archive, with the page display
On my site with all the latest versions (Drupal 6.10 and the last dev versions of CCK, Views and Viewfield), if I create a node of that type, whose title is "Trial". When I view it, the title output is "Monthly archive", and not "Trial" (nor "Recent posts", which would be bad also, anyway).
I'm sorry to insist. I hope you will find where is the trouble.
Thanks for your help.
#8
I understand the problem, but I think it happens even when there is only one page view, if that page view has a title. If you only experience the problem when you add a second page view, the first page view must not have a title.
#9
Yes, I've just tried, you're right ! It's the same with only one viewfield. Sorry for this confusion.
Thanks for your quick answer.
#10
----title dissapears ------ dev version 2009-march-10
I have a similar problem. (drupal 6.10)
When using viewfield (only one) the page title dissapears and the content is shown to the right side of the menu tabs on top (view .. edit ... outline..). With the dev-version before it was fine!
I tested different options under content type/display fields - no change at all. With all options I get the same display of the view linked by viewfield. Excluding the viewfield under "display views" makes no difference.
Only the choice "hidden" works to get the title shown again.
Oh- I just found out:
-> Content type/edit fields/viewfield/configure: When I chose ´view´-Standard it is ok, when I chose ´view-Page´ the explained problem shows up.
#11
Viewfield is not doing this. Page views by definition can set the page title. They think they're providing the whole page.
Creating a workaround would be a good project for a new developer. I explained what needs to be done in comment #4.
#12
I don't think a patch is appropriate as this is really just a hack, but, for those who need a solution as I did here's what I did to quickly resolve this with viewfield/views.
In .../all/modules/views/includes/view.inc I added these lines:
<?php
function get_title() {
# ---> all code just before the return statement of this routine <---
# For the viewfield module so that we can use the page's title and not a view generated title.
if (strtolower($title) == 'use_page_title') {
$node = node_load(arg(1));
$title = $node->title;
}
return $title;
}
?>
Then in my views display instead of putting in a title to use for the page I put in use_page_title.
Hope this helps.
#13
Duplicate issue 459590.
#14
Patch based on ramsalt's code in issue 443592.
#15
Fixed in CVS commit 214936.
#16
Automatically closed -- issue fixed for 2 weeks with no activity.